[Erp5-report] r26977 - in /erp5/trunk/products/ERP5Type: ./ Core/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu May 14 13:44:10 CEST 2009
Author: jerome
Date: Thu May 14 13:44:07 2009
New Revision: 26977
URL: http://svn.erp5.org?rev=26977&view=rev
Log:
get_transaction -> transaction
Modified:
erp5/trunk/products/ERP5Type/Core/Folder.py
erp5/trunk/products/ERP5Type/WebDAVSupport.py
erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
erp5/trunk/products/ERP5Type/tests/SecurityTestCase.py
erp5/trunk/products/ERP5Type/tests/Sequence.py
erp5/trunk/products/ERP5Type/tests/testCachedSkinsTool.py
erp5/trunk/products/ERP5Type/tests/testConstraint.py
erp5/trunk/products/ERP5Type/tests/testCopySupport.py
erp5/trunk/products/ERP5Type/tests/testERP5Type.py
erp5/trunk/products/ERP5Type/tests/testFolderMigration.py
erp5/trunk/products/ERP5Type/tests/testMemcachedTool.py
erp5/trunk/products/ERP5Type/tests/testPerformance.py
Modified: erp5/trunk/products/ERP5Type/Core/Folder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/Folder.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/Folder.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/Folder.py [utf8] Thu May 14 13:44:07 2009
@@ -26,6 +26,7 @@
#
##############################################################################
+import transaction
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base, aq_self
from OFS.History import Historical
@@ -957,7 +958,7 @@
f = os.path.join(dir, '%s___%s.zexp' % (folder_id,id))
ob = self._getOb(id)
ob._p_jar.exportFile(ob._p_oid,f)
- get_transaction().commit()
+ transaction.commit()
security.declareProtected( Permissions.ModifyPortalContent, 'recursiveApply')
def recursiveApply(self, filter=dummyFilter, method=None,
@@ -998,8 +999,8 @@
update_list += method_message
update_list += test_after(o,REQUEST=REQUEST)
# And commit subtransaction
- #get_transaction().commit(1)
- get_transaction().commit() # we may use commit(1) some day XXX
+ #transaction.commit(1)
+ transaction.commit() # we may use commit(1) some day XXX
# Recursively call recursiveApply if o has a recursiveApply method (not acquired)
obase = aq_base(o)
if hasattr(obase, 'recursiveApply'):
@@ -1043,7 +1044,7 @@
#for object in o.objectValues():
#LOG('Folder, updateAll ',0,"object.id: %s" % object.id)
obase = aq_base(o)
- get_transaction().commit()
+ transaction.commit()
if hasattr(obase, 'updateAll'):
update_list += o.updateAll(filter=filter, \
method=method, test_after=test_after,request=request,include=0,**kw)
@@ -1092,7 +1093,7 @@
self.manage_delObjects(id)
LOG("upradeObjectClass: ",0,"add new object: %s" % str(newob.id))
- get_transaction().commit() # XXX this commit should be after _setObject
+ transaction.commit() # XXX this commit should be after _setObject
LOG("upradeObjectClass: ",0,"newob.__class__: %s" % str(newob.__class__))
self._setObject(id, newob)
object_to_test = self._getOb(id)
@@ -1234,7 +1235,7 @@
btree_ok = self._cleanup()
if not btree_ok:
# We must commit if we want to keep on recursing
- get_transaction().commit(1)
+ transaction.commit(1)
error_list += [(self.getRelativeUrl(), 'BTree Inconsistency',
199, '(fixed)')]
# Call superclass
@@ -1242,7 +1243,7 @@
# We must commit before listing folder contents
# in case we erased some data
if fixit:
- get_transaction().commit(1)
+ transaction.commit(1)
# Then check the consistency on all sub objects
for obj in self.contentValues():
if fixit:
Modified: erp5/trunk/products/ERP5Type/WebDAVSupport.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/WebDAVSupport.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/WebDAVSupport.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/WebDAVSupport.py [utf8] Thu May 14 13:44:07 2009
@@ -13,6 +13,7 @@
##############################################################################
import re
+import transaction
from Acquisition import aq_parent, aq_inner, aq_base
from AccessControl import ClassSecurityInfo, ModuleSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
@@ -128,11 +129,11 @@
# XXX Can we get an error msg through? Should we be raising an
# exception, to be handled in the FTP mechanism? Inquiring
# minds...
- get_transaction().abort()
+ transaction.abort()
RESPONSE.setStatus(450)
return RESPONSE
except ResourceLockedError, msg:
- get_transaction().abort()
+ transaction.abort()
RESPONSE.setStatus(423)
return RESPONSE
Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Thu May 14 13:44:07 2009
@@ -31,6 +31,7 @@
except ImportError:
pass
+import transaction
from Testing import ZopeTestCase
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase, user_name
from Products.ERP5Type.tests.utils import getMySQLArguments
@@ -46,11 +47,6 @@
importLocalConstraint
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from zLOG import LOG, DEBUG
-
-try:
- from transaction import get as get_transaction
-except ImportError:
- pass
# Quiet messages when installing products
install_product_quiet = 1
@@ -443,9 +439,9 @@
ZopeTestCase._print('\nRecreating catalog ... ')
portal.portal_activities.manageClearActivities()
portal.portal_catalog.manage_catalogClear()
- get_transaction().commit()
+ transaction.commit()
portal.ERP5Site_reindexAll()
- get_transaction().commit()
+ transaction.commit()
self.tic()
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start,))
@@ -666,7 +662,7 @@
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start))
# Release locks
- get_transaction().commit()
+ transaction.commit()
if os.environ.get('erp5_load_data_fs'):
# Import local PropertySheets, Documents
@@ -718,7 +714,7 @@
object_to_update=install_kw,
update_translation=1)
# Release locks
- get_transaction().commit()
+ transaction.commit()
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
@@ -742,7 +738,7 @@
setattr(app,'isIndexable', 1)
portal.portal_catalog.manage_hotReindexAll()
- get_transaction().commit()
+ transaction.commit()
portal_activities = getattr(portal, 'portal_activities', None)
if portal_activities is not None:
@@ -754,7 +750,7 @@
while message_count > 0:
portal_activities.distribute()
portal_activities.tic()
- get_transaction().commit()
+ transaction.commit()
new_message_count = len(portal_activities.getMessageList())
if new_message_count != message_count:
if not quiet:
@@ -778,7 +774,7 @@
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,))
ZopeTestCase._print('Data.fs created\n')
- get_transaction().commit()
+ transaction.commit()
ZopeTestCase.close(app)
instance_home = os.environ['INSTANCE_HOME']
command = 'mysqldump --skip-extended-insert %s > %s/dump.sql' \
@@ -805,10 +801,10 @@
ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,))
ZopeTestCase._print('Ran Unit test of %s\n' % title)
except:
- get_transaction().abort()
+ transaction.abort()
raise
else:
- get_transaction().commit()
+ transaction.commit()
ZopeTestCase.close(app)
if os.environ.get('erp5_load_data_fs'):
@@ -850,7 +846,7 @@
"""
if kw.get('sequence', None) is None:
# in case of using not in sequence commit transaction
- get_transaction().commit()
+ transaction.commit()
self.tic()
def publish(self, path, basic=None, env=None, extra=None,
@@ -868,7 +864,7 @@
sm = getSecurityManager()
# Commit the sandbox for good measure
- get_transaction().commit()
+ transaction.commit()
if env is None:
env = {}
Modified: erp5/trunk/products/ERP5Type/tests/SecurityTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/SecurityTestCase.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/SecurityTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/SecurityTestCase.py [utf8] Thu May 14 13:44:07 2009
@@ -29,6 +29,7 @@
"""Base Class for security tests using ERP5Security and DCWorkflow
"""
+import transaction
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
@@ -122,7 +123,7 @@
"""Clean up for next test.
"""
self.tic()
- get_transaction().abort()
+ transaction.abort()
self.portal.portal_caches.clearAllCache()
ERP5TypeTestCase.tearDown(self)
Modified: erp5/trunk/products/ERP5Type/tests/Sequence.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/Sequence.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/Sequence.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/Sequence.py [utf8] Thu May 14 13:44:07 2009
@@ -26,14 +26,10 @@
#
##############################################################################
+import transaction
from Testing import ZopeTestCase
from zLOG import LOG
import random
-
-try:
- from transaction import get as get_transaction
-except ImportError:
- pass
import traceback
@@ -112,7 +108,7 @@
for idx, step in enumerate(self._step_list):
step.play(context, sequence=self, quiet=quiet)
# commit transaction after each step
- get_transaction().commit()
+ transaction.commit()
def addStep(self,method_name,required=1,max_replay=1):
new_step = Step(method_name=method_name,
Modified: erp5/trunk/products/ERP5Type/tests/testCachedSkinsTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testCachedSkinsTool.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testCachedSkinsTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testCachedSkinsTool.py [utf8] Thu May 14 13:44:07 2009
@@ -27,6 +27,7 @@
##############################################################################
import unittest
+import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
@@ -118,7 +119,7 @@
tested_skin_folder.manage_addProduct['OFSP'].manage_addFolder(id=searched_object_id)
# Commit transaction so that the created object gets a _p_jar, so it can be renamed.
# See OFS.CopySupport:CopySource.cb_isMoveable()
- get_transaction().commit(1)
+ transaction.commit(1)
self.getSkinnableObject().changeSkin(skinname=None)
# Access the object to make sure it is present in cache.
self.assertTrue(getattr(skinnable_object, searched_object_id, None) is not None)
Modified: erp5/trunk/products/ERP5Type/tests/testConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testConstraint.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testConstraint.py [utf8] Thu May 14 13:44:07 2009
@@ -26,6 +26,7 @@
#
##############################################################################
+import transaction
import unittest
import os
@@ -64,10 +65,10 @@
self.createCategories()
def beforeTearDown(self):
- get_transaction().abort()
+ transaction.abort()
module = self.portal.organisation_module
module.manage_delObjects(list(module.objectIds()))
- get_transaction().commit()
+ transaction.commit()
self.tic()
def stepTic(self,**kw):
@@ -99,7 +100,7 @@
"""
module = self.portal.getDefaultModule(self.object_portal_type)
obj = module.newContent(portal_type=self.object_portal_type)
- get_transaction().commit()
+ transaction.commit()
self.tic()
return obj
@@ -1120,7 +1121,7 @@
self.assertEquals(1, len(message_list))
self.assertNotEquals('', message_list[0].getTranslatedMessage())
related_obj.setGroupValue(obj)
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEquals(0, len(constraint.checkConsistency(obj)))
Modified: erp5/trunk/products/ERP5Type/tests/testCopySupport.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testCopySupport.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testCopySupport.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testCopySupport.py [utf8] Thu May 14 13:44:07 2009
@@ -27,6 +27,7 @@
##############################################################################
import unittest
+import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
#from AccessControl.SecurityManagement import newSecurityManager
@@ -58,20 +59,20 @@
portal_type='Organisation')
person = self.person_module.newContent(portal_type='Person',
career_subordination_value=organisation)
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEqual(0, len(self.portal.portal_activities.getMessageList()))
self.assertTrue(person.getCareerSubordination().startswith('organisation_module'))
self.assertTrue(person.getCareerSubordinationValue().aq_base is organisation.aq_base)
# Try to rename: must work
self.organisation_module.setId('new_organisation_module')
- get_transaction().commit()
+ transaction.commit()
self.assertTrue(person.getCareerSubordination().startswith('organisation_module'))
initial_activity_count = len(self.portal.portal_activities.getMessageList())
self.assertNotEqual(0, initial_activity_count)
# Try to rename again with pending activities: must raise
self.assertRaises(ActivityPendingError, self.organisation_module.setId, 'organisation_module')
- get_transaction().commit()
+ transaction.commit()
# Activity count must not have changed
self.assertEqual(initial_activity_count, len(self.portal.portal_activities.getMessageList()))
self.tic()
@@ -80,7 +81,7 @@
self.assertTrue(person.getCareerSubordinationValue().aq_base is organisation.aq_base)
# Rename back to original name
self.organisation_module.setId('organisation_module')
- get_transaction().commit()
+ transaction.commit()
self.tic()
# Check that relation is back to what it was
self.assertTrue(person.getCareerSubordination().startswith('organisation_module'))
Modified: erp5/trunk/products/ERP5Type/tests/testERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testERP5Type.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testERP5Type.py [utf8] Thu May 14 13:44:07 2009
@@ -66,7 +66,7 @@
def tearDown(self):
"""Clean up """
- get_transaction().abort()
+ transaction.abort()
ttool = self.getTypesTool()
class_tool = self.getClassTool()
# remove all property sheet we added to type informations
@@ -80,7 +80,7 @@
# could break next tests.
removeLocalPropertySheet(psheet)
ti.property_sheet_list = ps_list
- get_transaction().commit()
+ transaction.commit()
_aq_reset()
ERP5TypeTestCase.tearDown(self)
@@ -111,9 +111,9 @@
class_tool.newPropertySheet(property_sheet_name)
# XXX need to commit the transaction at this point, because class tool
# files are no longer available to the current transaction.
- get_transaction().commit()
+ transaction.commit()
class_tool.editPropertySheet(property_sheet_name, property_sheet_code)
- get_transaction().commit()
+ transaction.commit()
class_tool.importPropertySheet(property_sheet_name)
# We set the property sheet on the portal type
@@ -151,7 +151,7 @@
self.getTypesTool().getTypeInfo('Person').filter_content_types = 0
def beforeTearDown(self):
- get_transaction().abort()
+ transaction.abort()
for module in [ self.getPersonModule(),
self.getOrganisationModule(),
self.getCategoryTool().region ]:
@@ -162,7 +162,7 @@
self.getTypesTool().getTypeInfo('Person').acquire_local_roles = self.person_acquire_local_roles
self.portal.portal_caches.clearAllCache()
- get_transaction().commit()
+ transaction.commit()
self.tic()
def loginWithNoRole(self, quiet=0, run=run_all_test):
@@ -392,7 +392,7 @@
person_relative_url = person_object.getRelativeUrl()
def checkRelationSet(self):
- get_transaction().commit()
+ transaction.commit()
person_object.reindexObject()
category_object.reindexObject()
self.tic()
@@ -410,7 +410,7 @@
self.assertEquals( category_object.getRegionRelatedIdList(
portal_type = "Person"), [person_id] )
def checkRelationUnset(self):
- get_transaction().commit()
+ transaction.commit()
person_object.reindexObject()
category_object.reindexObject()
self.tic()
@@ -445,10 +445,10 @@
# Test _setRegion doesn't reindex the object.
person_object._setRegion(category_id)
- get_transaction().commit()
+ transaction.commit()
self.assertFalse(person_object.hasActivity())
person_object.setRegion(None)
- get_transaction().commit()
+ transaction.commit()
self.assertTrue(person_object.hasActivity())
self.tic()
@@ -579,7 +579,7 @@
folder.newContent(portal_type='Organisation', id=id_)
# commit a subtransaction, so that we can rename objecs (see
# OFS.ObjectManager._getCopy)
- get_transaction().commit(1)
+ transaction.commit(1)
for obj in folder.objectValues():
new_id = '%s_new' % obj.getId()
@@ -675,7 +675,7 @@
beta.reindexObject()
zeta.reindexObject()
nofunction.reindexObject()
- get_transaction().commit()
+ transaction.commit()
self.tic() # Make sure categories are reindexed
# Create a new person
@@ -758,7 +758,7 @@
# Uid setters (list, set, default)
person = module.newContent(portal_type='Person')
person.reindexObject()
- get_transaction().commit()
+ transaction.commit()
self.tic() # Make sure person is reindexed
person.setFunction('nofunction') # Fill at least one other category
person.setDefaultRegionUid(alpha.getUid())
@@ -1100,7 +1100,7 @@
default_organisation.getTitle())
# make sure this new organisation is indexed
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(1, len([m for m in
self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject'
@@ -1114,7 +1114,7 @@
person.setDefaultOrganisationTitle('New title')
self.assertEquals('New title',
default_organisation.getTitle())
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(1, len([m for m in
self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject'
@@ -1130,7 +1130,7 @@
default_organisation.getTitle())
self.assertEquals(0, len([m for m in
self.portal.portal_activities.getMessageList()]))
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(1, len([m for m in
self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject'
@@ -1158,7 +1158,7 @@
default_organisation.getReference())
# make sure this new organisation is indexed
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(1, len([m for m in
self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject'
@@ -1172,7 +1172,7 @@
person.setDefaultOrganisationReference('New reference')
self.assertEquals('New reference',
default_organisation.getReference())
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(1, len([m for m in
self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject'
@@ -1188,7 +1188,7 @@
default_organisation.getReference())
self.assertEquals(0, len([m for m in
self.portal.portal_activities.getMessageList()]))
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(1, len([m for m in
self.portal.portal_activities.getMessageList()
if m.method_id == 'immediateReindexObject'
@@ -1374,7 +1374,7 @@
# self.assertEquals(gender.getCategoryRelativeUrl(), new_copy.getGender())
new_copy = obj.asContext()
new_copy.edit(gender=gender.getCategoryRelativeUrl())
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEquals(gender.getCategoryRelativeUrl(), new_copy.getGender())
self.assertEquals(None, obj.getGender())
@@ -1440,7 +1440,7 @@
person.manage_permission('View', roles=['Auditor'], acquire=0)
# The user may not view the person object.
- get_transaction().commit() ; self.tic()
+ transaction.commit() ; self.tic()
self.assertTrue('Auditor' not in user.getRolesInContext(person))
self.logout()
newSecurityManager(None, user)
@@ -1455,7 +1455,7 @@
# reflect the security change, until the affected objects are
# reindexed, and Jean-Paul believes that this should not be
# automatic.
- get_transaction().commit() ; self.tic()
+ transaction.commit() ; self.tic()
self.assertTrue('Auditor' in user.getRolesInContext(person))
self.logout()
newSecurityManager(None, user)
@@ -1466,7 +1466,7 @@
# Now invoke the reindexing explicitly, so the catalog should be
# synchronized.
person_module.recursiveReindexObject()
- get_transaction().commit() ; self.tic()
+ transaction.commit() ; self.tic()
self.assertTrue('Auditor' in user.getRolesInContext(person))
self.logout()
newSecurityManager(None, user)
@@ -1527,7 +1527,7 @@
foo_path = foo.getRelativeUrl()
# Make sure categories are reindexed
- get_transaction().commit()
+ transaction.commit()
self.tic()
# Related accessor
@@ -1703,7 +1703,7 @@
gamma_path = gamma.getCategoryRelativeUrl()
# Make sure categories are reindexed
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEquals(beta.getRelativeUrl(), 'region/beta')
@@ -1955,7 +1955,7 @@
gamma_path = gamma.getCategoryRelativeUrl()
# Make sure categories are reindexed
- get_transaction().commit()
+ transaction.commit()
self.tic()
beta.manage_permission('View', roles=[], acquire=0)
@@ -2015,7 +2015,7 @@
gamma_path = gamma.getCategoryRelativeUrl()
# Make sure categories are reindexed
- get_transaction().commit()
+ transaction.commit()
self.tic()
beta.manage_permission('View', roles=[], acquire=0)
@@ -2102,7 +2102,7 @@
# gamma does not exist
# Make sure categories are reindexed
- get_transaction().commit()
+ transaction.commit()
self.tic()
# Create a new person, and associate it to beta and gamma.
@@ -2283,11 +2283,11 @@
subdocument_id = 'sub'
object = folder.newContent(portal_type='Organisation', id=initial_id)
object.newContent(id=subdocument_id)
- get_transaction().commit()
+ transaction.commit()
self.tic()
folder = self.getOrganisationModule()
folder.manage_renameObjects([initial_id], [final_id])
- get_transaction().commit()
+ transaction.commit()
self.tic()
folder = self.getOrganisationModule()
subdocument = folder[final_id][subdocument_id]
Modified: erp5/trunk/products/ERP5Type/tests/testFolderMigration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testFolderMigration.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testFolderMigration.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testFolderMigration.py [utf8] Thu May 14 13:44:07 2009
@@ -29,6 +29,7 @@
##############################################################################
import unittest
+import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
@@ -63,7 +64,7 @@
self.folder.manage_delObjects(ids=list(self.folder.objectIds()))
self.getPortal().manage_delObjects(ids=[self.folder.getId(),])
clearCache()
- get_transaction().commit()
+ transaction.commit()
self.tic()
def newContent(self, *args, **kwargs):
@@ -101,12 +102,12 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
+ transaction.commit()
self.tic()
# call migration script
self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate",
new_generate_id_method="_generatePerDayId")
- get_transaction().commit()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -170,7 +171,7 @@
# call migration script
self.folder.migrateToHBTree(migration_generate_id_method=None,
new_generate_id_method="_generatePerDayId")
- get_transaction().commit()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -201,11 +202,11 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
- self.tic()
- # call migration script
- self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
+ self.tic()
+ # call migration script
+ self.folder.migrateToHBTree()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -238,11 +239,11 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
- self.tic()
- # call migration script
- self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
+ self.tic()
+ # call migration script
+ self.folder.migrateToHBTree()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -263,7 +264,7 @@
# set id generator
id_generator_method = '_generatePerDayId'
self.folder.setIdGenerator(id_generator_method)
- get_transaction().commit()
+ transaction.commit()
self.assertEquals(self.folder.getIdGenerator(), id_generator_method)
# check object ids
self.assertEquals(obj1.getId(), '1')
@@ -295,12 +296,12 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
+ transaction.commit()
self.tic()
# call migration script
self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate",
new_generate_id_method="_generatePerDayId")
- get_transaction().commit()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -326,7 +327,7 @@
# call migration script again
self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate",
new_generate_id_method="_generatePerDayId")
- get_transaction().commit()
+ transaction.commit()
self.tic()
# check object ids
@@ -352,15 +353,15 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
+ transaction.commit()
self.tic()
# call migration script twice
self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate",
new_generate_id_method="_generatePerDayId")
- get_transaction().commit()
+ transaction.commit()
self.folder.migrateToHBTree(migration_generate_id_method="Base_generateIdFromStopDate",
new_generate_id_method="_generatePerDayId")
- get_transaction().commit()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -399,11 +400,11 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
- self.tic()
- # call migration script
- self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
+ self.tic()
+ # call migration script
+ self.folder.migrateToHBTree()
+ transaction.commit()
self.tic()
obj4 = self.newContent(id='BASE-123')
self.assertEquals(obj4.getId(), 'BASE-123')
@@ -428,11 +429,11 @@
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
- get_transaction().commit()
- self.tic()
- # call migration script
- self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
+ self.tic()
+ # call migration script
+ self.folder.migrateToHBTree()
+ transaction.commit()
self.tic()
obj4 = self.newContent(id='BASE-123')
obj5 = self.newContent(id='BASE-BELONG-123')
@@ -455,7 +456,7 @@
message = 'Test folderIsBtree'
LOG('Testing... ', 0, message)
self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
self.tic()
infolder = self.newContent()
@@ -483,11 +484,11 @@
obj1 = self.newContent(id=obj1_id)
obj2 = self.newContent(id=obj2_id)
obj3 = self.newContent(id=obj3_id)
- get_transaction().commit()
- self.tic()
- # call migration script
- self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
+ self.tic()
+ # call migration script
+ self.folder.migrateToHBTree()
+ transaction.commit()
self.tic()
# check we now have a hbtree
self.assertEqual(self.folder.isBTree(), False)
@@ -515,20 +516,20 @@
self.assertEqual(self.folder.isHBTree(), False)
setattr(self.folder,'_folder_handler','VeryWrongHandler')
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEqual(self.folder.isBTree(), False)
self.assertEqual(self.folder.isHBTree(), False)
self.assertEquals(self.folder._fixFolderHandler(), True)
- get_transaction().commit()
+ transaction.commit()
self.assertEqual(self.folder.isBTree(), True)
self.assertEqual(self.folder.isHBTree(), False)
self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEqual(self.folder.isBTree(), False)
@@ -544,21 +545,21 @@
self.assertEqual(self.folder.isHBTree(), False)
setattr(self.folder,'_folder_handler','VeryWrongHandler')
- get_transaction().commit()
- self.tic()
-
- self.assertEqual(self.folder.isBTree(), False)
- self.assertEqual(self.folder.isHBTree(), False)
-
- self.folder.migrateToHBTree()
- get_transaction().commit()
+ transaction.commit()
+ self.tic()
+
+ self.assertEqual(self.folder.isBTree(), False)
+ self.assertEqual(self.folder.isHBTree(), False)
+
+ self.folder.migrateToHBTree()
+ transaction.commit()
self.tic()
self.assertEqual(self.folder.isBTree(), False)
self.assertEqual(self.folder.isHBTree(), True)
self.folder.newContent()
- get_transaction().commit()
+ transaction.commit()
self.tic()
self.assertEqual(self.folder.isBTree(), False)
Modified: erp5/trunk/products/ERP5Type/tests/testMemcachedTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testMemcachedTool.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testMemcachedTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testMemcachedTool.py [utf8] Thu May 14 13:44:07 2009
@@ -29,6 +29,7 @@
import unittest
import os
+import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealMemcachedTool
@@ -121,7 +122,7 @@
# First, check that the local cache in memcachedTool works
tested_dict[tested_key] = tested_value
self.assertTrue(tested_dict[tested_key] is tested_value)
- get_transaction().commit()
+ transaction.commit()
# After a commit, check that the value is commited and grabbed from memcached
# again. Its value must not change, but the instance is not the same anymore.
self.assertTrue(tested_dict[tested_key] is not tested_value)
@@ -151,7 +152,7 @@
tested_dict[tested_key] = tested_value
self.assertTrue(tested_dict[tested_key] == tested_value)
del tested_dict[tested_key]
- get_transaction().commit()
+ transaction.commit()
try:
dummy = tested_dict[tested_key]
except KeyError:
Modified: erp5/trunk/products/ERP5Type/tests/testPerformance.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testPerformance.py?rev=26977&r1=26976&r2=26977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testPerformance.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testPerformance.py [utf8] Thu May 14 13:44:07 2009
@@ -30,6 +30,7 @@
from time import time
import gc
+import transaction
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
@@ -99,13 +100,13 @@
def beforeTearDown(self):
# Re-enable gc at teardown.
gc.enable()
- get_transaction().abort()
+ transaction.abort()
self.bar_module.manage_delObjects(list(self.bar_module.objectIds()))
self.foo_module.manage_delObjects(list(self.foo_module.objectIds()))
gender = self.getPortal().portal_categories['gender']
gender.manage_delObjects(list(gender.objectIds()))
gender = self.getPortal().portal_caches.clearAllCache()
- get_transaction().commit()
+ transaction.commit()
self.tic()
def checkViewBarObject(self, min, max, quiet=quiet, prefix=None):
@@ -123,7 +124,7 @@
title='Bar Test',
quantity=10000,)
bar.setReference(bar.getRelativeUrl())
- get_transaction().commit()
+ transaction.commit()
self.tic()
# Check performance
before_view = time()
@@ -181,7 +182,7 @@
if not quiet:
message = 'Test form to view Bar module'
LOG('Testing... ', 0, message)
- get_transaction().commit()
+ transaction.commit()
self.tic()
view_result = {}
tic_result = {}
@@ -194,7 +195,7 @@
title='Bar Test',
quantity="%4d" %(x,))
after_add = time()
- get_transaction().commit()
+ transaction.commit()
before_tic = time()
self.tic()
after_tic = time()
@@ -261,7 +262,7 @@
title='Line 1')
foo.newContent(portal_type='Foo Line',
title='Line 2')
- get_transaction().commit()
+ transaction.commit()
self.tic()
# Check performance
before_view = time()
@@ -292,7 +293,7 @@
for i in xrange(100):
foo.newContent(portal_type='Foo Line',
title='Line %s' % i)
- get_transaction().commit()
+ transaction.commit()
self.tic()
# Check performance
before_view = time()
More information about the Erp5-report
mailing list