Commit ab015313 authored by Łukasz Nowak's avatar Łukasz Nowak

Speedup.

Reindex the site and use catalog to update local roles. And do not reindex each object, as reindexation with catalog drop will be required anyway.
parent 89420809
......@@ -72,7 +72,6 @@ def Base_updateSlapOSLocalRoles(self):
@WorkflowMethod.disable
def real(self):
self.updateLocalRolesOnSecurityGroups(reindex=False)
self.immediateReindexObject()
if type(self) == type([]):
for o in self:
real(o[0])
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>context.getPortalObject().ERP5Site_reindexAll()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>04_ERP5Site_reindex</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -53,19 +53,21 @@
<value> <string encoding="cdata"><![CDATA[
portal = context.getPortalObject()\n
\n
portal_type_list = []\n
for portal_type in portal.portal_types.contentValues():\n
if len(portal_type.contentValues(portal_type=\'Role Information\')) > 0:\n
portal_type_list.append(portal_type.getId())\n
\n
tag = script.id\n
if portal.portal_activities.countMessageWithTag(tag) > 0:\n
raise TypeError(\'Already running\')\n
method_id = \'Base_updateSlapOSLocalRoles\'\n
for module_id in portal.objectIds(("ERP5 Folder",)):\n
if module_id.endswith("_module"):\n
portal[module_id].activate(tag=tag).recurseCallMethod(\n
method_id,\n
max_retry=0,\n
max_depth=5,\n
portal.portal_catalog.searchAndActivate(\n
portal_type=portal_type_list,\n
method_id=method_id,\n
activate_kw={\'tag\': tag,}\n
)\n
\n
)\n
return \'Done.\'\n
......@@ -77,7 +79,7 @@ return \'Done.\'\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>04_ERP5Site_updateLocalRoles</string> </value>
<value> <string>05_ERP5Site_updateLocalRoles</string> </value>
</item>
</dictionary>
</pickle>
......
16
\ No newline at end of file
17
\ No newline at end of file
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