[Erp5-report] r19289 - /erp5/trunk/products/ERP5/Document/OrderBuilder.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Feb 13 05:29:48 CET 2008


Author: yo
Date: Wed Feb 13 05:29:47 2008
New Revision: 19289

URL: http://svn.erp5.org?rev=19289&view=rev
Log:
Comment in details. Do not repeat the same code. Fix a variable name.

Modified:
    erp5/trunk/products/ERP5/Document/OrderBuilder.py

Modified: erp5/trunk/products/ERP5/Document/OrderBuilder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderBuilder.py?rev=19289&r1=19288&r2=19289&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderBuilder.py (original)
+++ erp5/trunk/products/ERP5/Document/OrderBuilder.py Wed Feb 13 05:29:47 2008
@@ -536,18 +536,23 @@
     if delivery_after_generation_script_id not in ["", None]:
       for delivery in delivery_list:
         script = getattr(delivery, delivery_after_generation_script_id)
+        # BBB: Only Python Scripts were used in the past, and they might not
+        # accept an arbitrary argument. So to keep compatibility,
+        # check if it can take the new parameter safely, only when
+        # the callable object is a Python Script.
+        safe_to_pass_parameter = True
         meta_type = getattr(script, 'meta_type', None)
         if meta_type == 'Script (Python)':
           # check if the script accepts related_simulation_movement_path_list
-          accept_param = False
+          safe_to_pass_parameter = False
           for param in script.params().split(','):
             param = param.split('=', 1)[0].strip()
-            if param == 'related_simulation_movement_path_list' or param.startswith('**'):
-              accept_param = True
+            if param == 'related_simulation_movement_path_list' \
+                    or param.startswith('**'):
+              safe_to_pass_parameter = True
               break
-          if accept_param:
-            script(related_simulation_movement_path_list=related_simulation_movement_path_list)
-          else:
-            script()
+
+        if safe_to_pass_parameter:
+          script(related_simulation_movement_path_list=related_simulation_movement_path_list)
         else:
-          script(related_simulation_movement_path_list=related_simulation_movement_path_list)
+          script()




More information about the Erp5-report mailing list