Commit 32bae836 authored by Julien Muchembled's avatar Julien Muchembled

testERP5Security: fix test_ReallyDeletedPersonIsNotUser

It was broken by commit 42281

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42300 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3832a68b
......@@ -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>
......
<?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>
......@@ -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>
......
935
\ No newline at end of file
936
\ No newline at end of file
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment