Commit eddd288f authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix a bug with default parameters

parent ad1dca7b
......@@ -220,14 +220,16 @@ class Workflow(threading.Thread):
def _set_parameters(self, args):
parameters = self.get_parameters()
for param in parameters:
if args[param.name]:
try: args[param.name] = args[param.name].encode('ascii','ignore')
except: pass
if param.__class__ == Parameter:
new_param = Parameter(param.name, param.help, default=args[param.name], type=param.type, choices=param.choices,
if args[param.name]: default = args[param.name]
else: default = param.default
new_param = Parameter(param.name, param.help, default=default, type=param.type, choices=param.choices,
required=param.required, flag=param.flag, group=param.group, display_name=param.display_name)
self.__setattr__(param.name, new_param)
elif param.__class__ == InputFile:
if args[param.name]:
# handle url inputs
default, is_uri = self._download_urlfile(args[param.name])
# handle upload inputs
......@@ -235,11 +237,14 @@ class Workflow(threading.Thread):
except: is_local = False
if not is_uri and not is_local and param.type.__name__ == "inputfile" or param.type.__name__ == "browsefile":
default = os.path.join(self.jflow_config_reader.get_tmp_directory(), (args[param.name]))
else:
default = param.default
new_param = InputFile(param.name, param.help, file_format=param.file_format, default=default, type=param.type,
choices=param.choices, required=param.required, flag=param.flag,
group=param.group, display_name=param.display_name)
self.__setattr__(param.name, new_param)
elif param.__class__ == InputFileList:
if args[param.name]:
path2test = args[param.name]
if not path2test.__class__.__name__ == "list":
path2test = [path2test]
......@@ -261,6 +266,7 @@ class Workflow(threading.Thread):
default_vals.append(os.path.join(self.jflow_config_reader.get_tmp_directory(), (path)))
self.__getattribute__(param.name).extend(default_vals)
elif param.__class__ == ParameterList:
if args[param.name]:
self.__getattribute__(param.name).extend(args[param.name])
elif param.__class__ == MultiParameter:
sub_args = {}
......
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