Commit fd1e4ec4 authored by Nicolas Delaby's avatar Nicolas Delaby

Use activities to update object_list

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15482 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4844780d
...@@ -509,18 +509,21 @@ def updateRoleMappings(self, REQUEST=None): ...@@ -509,18 +509,21 @@ def updateRoleMappings(self, REQUEST=None):
elif include_default == 1: elif include_default == 1:
portal_type_list.append(tid) portal_type_list.append(tid)
count = 0 object_list = self.portal_catalog(portal_type=portal_type_list, limit=None)
#update the objects using these portal types object_list_len = len(object_list)
if len(portal_type_list) > 0: portal_activities = self.portal_activities
portal_catalog = self.portal_catalog object_path_list = [x.path for x in object_list]
for brain in portal_catalog(portal_type=portal_type_list): for i in xrange(0, object_list_len, 100):
obj = brain.getObject() current_path_list = object_path_list[i:i+100]
self.updateRoleMappingsFor(obj) portal_activities.activate(activity='SQLQueue',
count += 1 priority=5)\
.callMethodOnObjectList(current_path_list,
'updateRoleMappingsFor',
wf_id = self.getId())
if REQUEST is not None: if REQUEST is not None:
return self.manage_properties(REQUEST, return self.manage_properties(REQUEST,
manage_tabs_message='%d object(s) updated.' % count) manage_tabs_message='%d object(s) updated.' % object_list_len)
else: else:
return count return count
......
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