Commit 053677a5 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix a bug with inputfile + add component parent info on multiple parameter type

parent 9913e8ae
......@@ -69,6 +69,9 @@ class Component(object):
required=False, flag=None, group="default", display_name=None, add_to=None):
new_param = InputFile(name, help, flag=flag, file_format=file_format, default=default,
type=type, required=required, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
if issubclass( default.__class__, AbstractOutputFile ):
new_param.parent_component_nameid = default.component_nameid
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -76,9 +79,6 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
if issubclass( default.__class__, AbstractOutputFile ):
new_param.parent_component_nameid = default.component_nameid
self.params_order.append(name)
self.__setattr__(name, new_param)
......@@ -87,6 +87,9 @@ class Component(object):
if default == None: default = []
new_param = InputFileList(name, help, flag=flag, file_format=file_format, default=default,
type=type, required=required, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
if issubclass( default.__class__, AbstractOutputFile ):
new_param.parent_component_nameid = default.component_nameid
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -94,9 +97,6 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
if issubclass( default.__class__, AbstractOutputFile ):
new_param.parent_component_nameid = default.component_nameid
self.params_order.append(name)
self.__setattr__(name, new_param)
......@@ -133,6 +133,7 @@ class Component(object):
filename = os.path.basename(filename)
new_param = OutputFile(name, help, default=os.path.join(self.output_directory, filename),
file_format=file_format, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -140,7 +141,6 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
self.params_order.append(name)
self.__setattr__(name, new_param)
......@@ -148,6 +148,7 @@ class Component(object):
items=None, group="default", display_name=None, add_to=None):
new_param = OutputFileList(name, help, default=self.get_outputs(pattern, items),
file_format=file_format, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -155,7 +156,6 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
self.params_order.append(name)
self.__setattr__(name, new_param)
......@@ -163,6 +163,7 @@ class Component(object):
group="default", display_name=None, add_to=None):
new_param = OutputFilesEndsWith(name, help, self.output_directory, pattern, include=(behaviour != "exclude"),
file_format="any", group="default", display_name=None)
new_param.component_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -170,7 +171,6 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
self.params_order.append(name)
self.__setattr__(name, new_param)
......@@ -178,6 +178,7 @@ class Component(object):
group="default", display_name=None, add_to=None):
new_param = OutputFilesPattern(name, help, self.output_directory, pattern, include=(behaviour != "exclude"),
file_format="any", group="default", display_name=None)
new_param.component_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -185,7 +186,6 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
self.params_order.append(name)
self.__setattr__(name, new_param)
......
......@@ -683,8 +683,12 @@ class InputFileList(ParameterList, AbstractInputFile):
return list.__init__(self, [default])
elif default.__class__.__name__ == "list":
return list.__init__(self, default)
elif issubclass( default.__class__, InputFile ):
return list.__init__(self, [default])
elif issubclass( default.__class__, AbstractInputFile ):
return list.__init__(self, default)
elif issubclass( default.__class__, OutputFile ):
return list.__init__(self, [default])
elif issubclass( default.__class__, AbstractOutputFile ):
return list.__init__(self, default)
......
Supports Markdown
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