From 56edeedcaf9f6a5438442c355fe3bb9823c16c80 Mon Sep 17 00:00:00 2001 From: Nicolas Dumazet <nicolas.dumazet@nexedi.com> Date: Tue, 1 Feb 2011 02:45:47 +0000 Subject: [PATCH] replace _aq_reset calls/resetDynamicDocuments calls with resetDynamicDocumentsOnceAtTransactionBoundary calls git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42859 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Tool/ClassTool.py | 9 ++++----- product/ERP5Type/TranslationProviderBase.py | 5 +++-- product/ERP5Type/tests/testERP5Type.py | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/product/ERP5Type/Tool/ClassTool.py b/product/ERP5Type/Tool/ClassTool.py index 2d48253eb0..a1c6fef219 100644 --- a/product/ERP5Type/Tool/ClassTool.py +++ b/product/ERP5Type/Tool/ClassTool.py @@ -61,7 +61,6 @@ from Products.ERP5Type.Utils import readLocalDocument, writeLocalDocument, getLo from Products.ERP5Type.Utils import readLocalConstraint, writeLocalConstraint, getLocalConstraintList from Products.ERP5Type.InitGenerator import getProductDocumentPathList -from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import newTempDocumentationHelper from Products.ERP5Type import allowClassTool @@ -222,7 +221,7 @@ if allowClassTool(): def reimport(self, status, class_id): if status and self.__importer is not None: self.__importer(class_id) - _aq_reset() + self.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() def _getOb(self, key, default=_MARKER ): if key in self.objectIds(): @@ -550,7 +549,7 @@ class %s(XMLObject): # Clear object cache and reset _aq_dynamic after reload self._clearCache() - _aq_reset() + self.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() if REQUEST is not None and class_path is None: REQUEST.RESPONSE.redirect('%s/manage_editDocumentForm?class_id=%s&manage_tabs_message=Document+Reloaded+Successfully' % (self.absolute_url(), class_id)) @@ -661,7 +660,7 @@ class %s: # Reset _aq_dynamic after reload # There is no need to reset the cache in this case because # XXX it is not sure however that class defined propertysheets will be updated - _aq_reset() + self.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() if REQUEST is not None: REQUEST.RESPONSE.redirect('%s/manage_editPropertySheetForm?class_id=%s&manage_tabs_message=PropertySheet+Reloaded+Successfully' % (self.absolute_url(), class_id)) @@ -928,7 +927,7 @@ class %s(Constraint): # Reset _aq_dynamic after reload # There is no need to reset the cache in this case because # XXX it is not sure however that class defined propertysheets will be updated - _aq_reset() + self.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() if REQUEST is not None: REQUEST.RESPONSE.redirect('%s/manage_editConstraintForm?class_id=%s&manage_tabs_message=Constraint+Reloaded+Successfully' % (self.absolute_url(), class_id)) diff --git a/product/ERP5Type/TranslationProviderBase.py b/product/ERP5Type/TranslationProviderBase.py index 273ff1fa93..71361fdcde 100644 --- a/product/ERP5Type/TranslationProviderBase.py +++ b/product/ERP5Type/TranslationProviderBase.py @@ -155,8 +155,9 @@ class TranslationProviderBase(object): if new_domain_name != prop_object.getDomainName(): prop_object.edit(domain_name=new_domain_name) - from Products.ERP5Type.Base import _aq_reset - _aq_reset() # Reset accessor cache + # Reset accessor cache + types_tool = self.getPortalObject().portal_types + types_tool.resetDynamicDocumentsOnceAtTransactionBoundary() if REQUEST is not None: return self.manage_editTranslationForm(REQUEST, manage_tabs_message= diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index 636959ce71..f7bdb7028c 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -76,8 +76,11 @@ class PropertySheetTestCase(ERP5TypeTestCase): if psheet in property_sheet_set: property_sheet_set.remove(psheet) ti._setTypePropertySheetList(list(property_sheet_set)) + # this is useful if somehow the interaction workflows is set + # wrongly. If the interaction has been called already it does nothing, + # but in the other hand, if isolates the test "just in case" + ttool.resetDynamicDocumentsOnceAtTransactionBoundary() transaction.commit() - ttool.resetDynamicDocuments() super(PropertySheetTestCase, self).tearDown() def _addProperty(self, portal_type_name, property_sheet_id, property_id, **kw): -- 2.30.9