Commit ac14df70 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[erp5_core] Mass Workflow Transition saves some time and memory by early return and iterators

parent 7b07b5b3
......@@ -3,14 +3,14 @@
portal_catalog = context.getPortalObject().portal_catalog
action_tool = context.getPortalObject().portal_actions
document_list = [result.getObject() for result in portal_catalog.searchResults(sort_on=sort_on, limit=limit, **kwargs)]
result_list = portal_catalog.searchResults(sort_on=sort_on, limit=limit, **kwargs)
if not workflow_action:
# if we have no filter (=workflow action) we return back all documents
return document_list
return result_list
filtered_list = []
for document in document_list:
for document in (result.getObject() for result in result_list):
for action in action_tool.listFilteredActionsFor(document).get('workflow', []):
if action['id'] == workflow_action:
filtered_list.append(document)
......
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