Commit 800c2bd6 authored by Frédéric Escudié's avatar Frédéric Escudié
Browse files

Fix bug with the attribute subparameters in set_parameters.

parent 7b8c3cbf
...@@ -365,7 +365,6 @@ class MultiParameter(dict, AbstractParameter): ...@@ -365,7 +365,6 @@ class MultiParameter(dict, AbstractParameter):
self.type.required.append(param_flag) self.type.required.append(param_flag)
self.help = self.global_help + self.type.get_help() self.help = self.global_help + self.type.get_help()
param.flag = param_flag param.flag = param_flag
self[param.name] = param
self.sub_parameters.append(param) self.sub_parameters.append(param)
...@@ -401,7 +400,6 @@ class MultiParameterList(list, AbstractParameter): ...@@ -401,7 +400,6 @@ class MultiParameterList(list, AbstractParameter):
self.type.required.append(param_flag) self.type.required.append(param_flag)
self.help = self.global_help + self.type.get_help() self.help = self.global_help + self.type.get_help()
param.flag = param_flag param.flag = param_flag
self.append(param)
self.sub_parameters.append(param) self.sub_parameters.append(param)
......
...@@ -263,13 +263,16 @@ class Workflow(threading.Thread): ...@@ -263,13 +263,16 @@ class Workflow(threading.Thread):
new_param = None new_param = None
if param.__class__ == MultiParameter: if param.__class__ == MultiParameter:
new_param = MultiParameter(param.name, param.help, required=param.required, flag=param.flag, group=param.group, display_name=param.display_name) new_param = MultiParameter(param.name, param.help, required=param.required, flag=param.flag, group=param.group, display_name=param.display_name)
new_param.sub_parameters = param.sub_parameters
sub_args = {} sub_args = {}
for sarg in args[param.name]: for sarg in args[param.name]:
sub_args[sarg[0]] = sarg[1] sub_args[sarg[0]] = sarg[1]
for sub_param in param.sub_parameters: for sub_param in param.sub_parameters:
new_param.add_sub_parameter(self._prepare_parameter(sub_args, sub_param)) new_sub_parameter = self._prepare_parameter(sub_args, sub_param)
new_param[new_sub_parameter.name] = new_sub_parameter
elif param.__class__ == MultiParameterList: elif param.__class__ == MultiParameterList:
new_param = MultiParameterList(param.name, param.help, required=param.required, flag=param.flag, group=param.group, display_name=param.display_name) new_param = MultiParameterList(param.name, param.help, required=param.required, flag=param.flag, group=param.group, display_name=param.display_name)
new_param.sub_parameters = param.sub_parameters
for idx, sargs in enumerate(args[param.name]): for idx, sargs in enumerate(args[param.name]):
new_multi_param = MultiParameter(param.name + '_' + str(idx), '', required=False, flag=None, group="default", display_name=None) new_multi_param = MultiParameter(param.name + '_' + str(idx), '', required=False, flag=None, group="default", display_name=None)
sub_args = {} sub_args = {}
...@@ -277,10 +280,10 @@ class Workflow(threading.Thread): ...@@ -277,10 +280,10 @@ class Workflow(threading.Thread):
sub_args[sarg[0]] = sarg[1] sub_args[sarg[0]] = sarg[1]
for sub_param in param.sub_parameters: for sub_param in param.sub_parameters:
new_sub_param = self._prepare_parameter(sub_args, sub_param) new_sub_param = self._prepare_parameter(sub_args, sub_param)
new_multi_param.add_sub_parameter(sub_param) new_multi_param[new_sub_param.name] = new_sub_param
new_param.add_sub_parameter(new_multi_param) new_param.append(new_multi_param)
else: else:
new_param = self._prepare_parameter(args, param ) new_param = self._prepare_parameter(args, param)
self.__setattr__(param.name, new_param) self.__setattr__(param.name, new_param)
def get_execution_graph(self): def get_execution_graph(self):
......
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