[Erp5-report] r40423 jm - /erp5/trunk/products/ERP5Type/patches/DCWorkflow.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 19 17:23:49 CET 2010


Author: jm
Date: Fri Nov 19 17:23:49 2010
New Revision: 40423

URL: http://svn.erp5.org?rev=40423&view=rev
Log:
DCWorkflowDefinition_executeTransition: small optimization

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=40423&r1=40422&r2=40423&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/DCWorkflow.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/DCWorkflow.py [utf8] Fri Nov 19 17:23:49 2010
@@ -401,15 +401,15 @@ def DCWorkflowDefinition_executeTransiti
     self.updateRoleMappingsFor(ob)
 
     # Execute the "after" script.
-    if tdef is not None and tdef.after_script_name:
+    script = getattr(tdef, 'after_script_name', None)
+    if script:
         # Script can be either script or workflow method
         #LOG('_executeTransition', 0, 'new_sdef.transitions = %s' % (repr(new_sdef.transitions)))
-        if tdef.after_script_name in filter(lambda k: self.transitions[k].trigger_type == TRIGGER_WORKFLOW_METHOD,
-                                                                                  new_sdef.transitions):
-          script = getattr(ob, convertToMixedCase(tdef.after_script_name))
-          script()
+        if script in new_sdef.transitions and  \
+           self.transitions[script].trigger_type == TRIGGER_WORKFLOW_METHOD:
+          getattr(ob, convertToMixedCase(script))()
         else:
-          script = self.scripts[tdef.after_script_name]
+          script = self.scripts[script]
           # Pass lots of info to the script in a single parameter.
           sci = StateChangeInfo(
               ob, self, status, tdef, old_sdef, new_sdef, kwargs)




More information about the Erp5-report mailing list