[Erp5-report] r15482 - /erp5/trunk/products/ERP5Type/patches/DCWorkflow.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Aug 6 10:21:24 CEST 2007
Author: nicolas
Date: Mon Aug 6 10:21:24 2007
New Revision: 15482
URL: http://svn.erp5.org?rev=15482&view=rev
Log:
Use activities to update object_list
Modified:
erp5/trunk/products/ERP5Type/patches/DCWorkflow.py
Modified: erp5/trunk/products/ERP5Type/patches/DCWorkflow.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/DCWorkflow.py?rev=15482&r1=15481&r2=15482&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/DCWorkflow.py (original)
+++ erp5/trunk/products/ERP5Type/patches/DCWorkflow.py Mon Aug 6 10:21:24 2007
@@ -509,18 +509,21 @@
elif include_default == 1:
portal_type_list.append(tid)
- count = 0
- #update the objects using these portal types
- if len(portal_type_list) > 0:
- portal_catalog = self.portal_catalog
- for brain in portal_catalog(portal_type=portal_type_list):
- obj = brain.getObject()
- self.updateRoleMappingsFor(obj)
- count += 1
+ object_list = self.portal_catalog(portal_type=portal_type_list, limit=None)
+ object_list_len = len(object_list)
+ portal_activities = self.portal_activities
+ object_path_list = [x.path for x in object_list]
+ for i in xrange(0, object_list_len, 100):
+ current_path_list = object_path_list[i:i+100]
+ portal_activities.activate(activity='SQLQueue',
+ priority=5)\
+ .callMethodOnObjectList(current_path_list,
+ 'updateRoleMappingsFor',
+ wf_id = self.getId())
if REQUEST is not None:
return self.manage_properties(REQUEST,
- manage_tabs_message='%d object(s) updated.' % count)
+ manage_tabs_message='%d object(s) updated.' % object_list_len)
else:
return count
More information about the Erp5-report
mailing list