Commit 700675ee authored by iv's avatar iv

ERP5Workflow: PERF: list comprehension instead of appending objects

parent 9187326b
...@@ -210,11 +210,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow): ...@@ -210,11 +210,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
security.declarePrivate('getTransitionIdList') security.declarePrivate('getTransitionIdList')
def getTransitionIdList(self): def getTransitionIdList(self):
id_list = [] return [ob.getReference() for ob in self.objectValues(portal_type="Interaction")]
append = id_list.append
for ob in self.objectValues(portal_type="Interaction"):
append(ob.getReference())
return id_list
security.declarePrivate('notifyWorkflowMethod') security.declarePrivate('notifyWorkflowMethod')
def notifyWorkflowMethod(self, ob, transition_list, args=None, kw=None): def notifyWorkflowMethod(self, ob, transition_list, args=None, kw=None):
......
...@@ -142,9 +142,10 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject, ...@@ -142,9 +142,10 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject,
key_list.append('validation_state') key_list.append('validation_state')
if self.getMatchedCausalityState(): if self.getMatchedCausalityState():
key_list.append('causality_state') key_list.append('causality_state')
for dynamic_variable in self.objectValues():
if dynamic_variable.getVariableValue() or dynamic_variable.getVariableExpression(): key_list += [dynamic_variable.getReference() for dynamic_variable in self.objectValues()
key_list.append(dynamic_variable.getReference()) if dynamic_variable.getVariableValue() or dynamic_variable.getVariableExpression()]
return key_list return key_list
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
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