Commit 114b7d9c authored by Łukasz Nowak's avatar Łukasz Nowak

Really optimise.

Generate activities and allow to pass the tag. Use search and activate
everywhere which will allow to walk through objects without killing the cluster
even in case of really big documents.
parent ce1cde2f
......@@ -71,7 +71,7 @@ kw[\'portal_type\'] = portal.getPortalOpenOrderTypeList()\n
\n
portal.portal_catalog.searchAndActivate(\n
method_id=\'OpenOrder_updateSimulation\',\n
method_kw={\'activity\': False},\n
method_kw={\'tag\': tag},\n
packet_size=1, # As OpenOrder_updateSimulation can generate big transaction separate the calls\n
activate_kw={\'tag\':tag, \'priority\': 8},\n
**kw # XXX: In one query put parents of last modified lines\n
......
<?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>activate_kw={\'tag\': tag}\n
for path in [context] + context.getCellValueList():\n
for item in path.getAggregateValueList():\n
if item.providesIExpandableItem():\n
applied_rule = item.getCausalityRelatedValue(portal_type=\'Applied Rule\')\n
if applied_rule is not None:\n
applied_rule.expand(activate_kw=activate_kw)\n
else:\n
item.expand(activate_kw=activate_kw)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenOrderLine_updateSimulation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -50,33 +50,17 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>subscription_item_dict = dict()\n
\n
for open_order_line in context.contentValues():\n
for path in [open_order_line] + open_order_line.getCellValueList():\n
for item in path.getAggregateValueList():\n
if item.providesIExpandableItem(): # XXX hack to make it fails\n
subscription_item_dict[item] = 1\n
\n
# XXX tag / after tag !\n
for item in subscription_item_dict:\n
activate_kw = dict(tag=\'%s_expand\' % item.getPath())\n
applied_rule = item.getCausalityRelatedValue(portal_type=\'Applied Rule\')\n
if applied_rule is not None:\n
if activity:\n
applied_rule.activate(activate_kw=activate_kw).expand(activate_kw=activate_kw)\n
else:\n
applied_rule.expand(activate_kw=activate_kw)\n
else:\n
if activity:\n
item.activate(activate_kw=activate_kw).expand(activate_kw=activate_kw)\n
else:\n
item.expand(activate_kw=activate_kw)\n
<value> <string>context.getPortalObject().portal_catalog.searchAndActivate(\n
parent_uid=context.getUid(),\n
method_id=\'OpenOrderLine_updateSimulation\',\n
method_kw={\'tag\': tag},\n
activate_kw={\'tag\':tag}\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>activity=True</string> </value>
<value> <string>tag=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
......@@ -6,6 +6,27 @@
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
......
109
\ No newline at end of file
110
\ 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