Commit d0524a36 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Comment in details. Do not repeat the same code. Fix a variable name.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19289 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b0d033de
...@@ -536,18 +536,23 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -536,18 +536,23 @@ class OrderBuilder(XMLObject, Amount, Predicate):
if delivery_after_generation_script_id not in ["", None]: if delivery_after_generation_script_id not in ["", None]:
for delivery in delivery_list: for delivery in delivery_list:
script = getattr(delivery, delivery_after_generation_script_id) 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) meta_type = getattr(script, 'meta_type', None)
if meta_type == 'Script (Python)': if meta_type == 'Script (Python)':
# check if the script accepts related_simulation_movement_path_list # check if the script accepts related_simulation_movement_path_list
accept_param = False safe_to_pass_parameter = False
for param in script.params().split(','): for param in script.params().split(','):
param = param.split('=', 1)[0].strip() param = param.split('=', 1)[0].strip()
if param == 'related_simulation_movement_path_list' or param.startswith('**'): if param == 'related_simulation_movement_path_list' \
accept_param = True or param.startswith('**'):
safe_to_pass_parameter = True
break break
if accept_param:
script(related_simulation_movement_path_list=related_simulation_movement_path_list) if safe_to_pass_parameter:
else:
script()
else:
script(related_simulation_movement_path_list=related_simulation_movement_path_list) script(related_simulation_movement_path_list=related_simulation_movement_path_list)
else:
script()
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