diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml index 6cd2d0b3db0f5c75203f787158ccf55647e342f3..9cb8aa3b65bf610c8b38bec97383648f8c61cd2b 100644 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml +++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onDeleteUserLoginPerson.xml @@ -57,12 +57,13 @@ <value> <list> <string>delete</string> + <string>manage_beforeDelete</string> </list> </value> </item> <item> <key> <string>once_per_transaction</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>portal_type_filter</string> </key> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onRealDeleteUserLoginPerson.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onRealDeleteUserLoginPerson.xml deleted file mode 100644 index 8f724fde2c3a84448ab6a7d1efc387b1ed6379e5..0000000000000000000000000000000000000000 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/interactions/ClearContentShortCache_onRealDeleteUserLoginPerson.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>actbox_category</string> </key> - <value> <string>workflow</string> </value> - </item> - <item> - <key> <string>actbox_name</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>actbox_url</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>activate_script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>after_script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>before_commit_script_name</string> </key> - <value> - <list> - <string>Person_clearContentShortCache</string> - </list> - </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>guard</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>ClearContentShortCache_onRealDeleteUserLoginPerson</string> </value> - </item> - <item> - <key> <string>method_id</string> </key> - <value> - <list> - <string>manage_beforeDelete</string> - </list> - </value> - </item> - <item> - <key> <string>once_per_transaction</string> </key> - <value> <int>0</int> </value> - </item> - <item> - <key> <string>portal_type_filter</string> </key> - <value> - <list> - <string>Person</string> - </list> - </value> - </item> - <item> - <key> <string>script_name</string> </key> - <value> - <tuple/> - </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>trigger_type</string> </key> - <value> <int>2</int> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml index 7af19a56b9f539f56fbf5c1d0058808e410e967a..c90b2558a9d5315c2ada51859deaef601e9676d5 100644 --- a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml +++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/person_interaction_workflow/scripts/Person_clearContentShortCache.xml @@ -54,7 +54,8 @@ document = state_change[\'object\']\n if document.getReference() is not None:\n cache_tool = document.getPortalObject().portal_caches\n - cache_tool.clearCache(cache_factory_list=(\'erp5_content_short\', ))\n + cache_tool.clearCache(cache_factory_list=(\'erp5_content_short\', ),\n + before_commit=True)\n </string> </value> </item> <item> diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision index 9597ee0e6b5efb51990180c8f920e7905c9a3b64..1fb6394a79f96c1e678be0e1f9feb5f82b42723c 100644 --- a/bt5/erp5_base/bt/revision +++ b/bt5/erp5_base/bt/revision @@ -1 +1 @@ -935 \ No newline at end of file +936 \ No newline at end of file diff --git a/product/ERP5Type/Tool/CacheTool.py b/product/ERP5Type/Tool/CacheTool.py index 3f933d47be4b349286f2fc9d1dcd39eab45fa186..e3480c7cd6bf2931f2b3899746291cfcf7d2bcdc 100644 --- a/product/ERP5Type/Tool/CacheTool.py +++ b/product/ERP5Type/Tool/CacheTool.py @@ -29,6 +29,7 @@ """ Cache Tool module for ERP5 """ +import transaction from AccessControl import ClassSecurityInfo from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type import Permissions @@ -158,8 +159,13 @@ class CacheTool(BaseTool): self.REQUEST.RESPONSE.redirect('cache_tool_configure?manage_tabs_message=Cache factory %s cleared.' %cache_factory_id) security.declareProtected(Permissions.ModifyPortalContent, 'clearCache') - def clearCache(self, cache_factory_list=(DEFAULT_CACHE_FACTORY,), REQUEST=None): + def clearCache(self, cache_factory_list=(DEFAULT_CACHE_FACTORY,), + REQUEST=None, before_commit=False): """ Clear specified or default cache factory. """ + if before_commit: + assert REQUEST is None + transaction.get().addBeforeCommitHook(self.clearCache, + (cache_factory_list,)) ram_cache_root = self.getRamCacheRoot() for cf_key in cache_factory_list: if ram_cache_root.has_key(cf_key):