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

make hierarchie OK

parent 22b46d74
......@@ -82,6 +82,9 @@ class Component(object):
except: pass
# otherwise, add it to the class itself
else:
new_param.component_nameid = self.get_nameid()
if default.__class__.__name__ == "OutputFileList" or default.__class__.__name__ == "OutputFile":
new_param.parent_component_nameid = default.component_nameid
self.params_order.append(name)
self.__setattr__(name, new_param)
......@@ -119,6 +122,7 @@ 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)
......
......@@ -296,9 +296,11 @@ class AbstractParameter(object):
return self.type.__name__
class AbstractFile(object):
class AbstractIOFile(object):
def __init__(self, file_format="any"):
self.file_format = file_format
self.component_nameid = None
self.parent_component_nameid = None
......@@ -384,7 +386,7 @@ class Parameter(str, AbstractParameter):
action="store", sub_parameters=sub_parameters, group=group, display_name=display_name)
class InputFile(Parameter, AbstractFile):
class InputFile(Parameter, AbstractIOFile):
def __new__(self, name, help, file_format="any", default="", type="localfile", choices=None,
required=False, flag=None, group="default", display_name=None):
......@@ -401,12 +403,12 @@ class InputFile(Parameter, AbstractFile):
def __init__(self, name, help, file_format="any", default="", type="localfile", choices=None,
required=False, flag=None, group="default", display_name=None):
AbstractFile.__init__(self, file_format)
AbstractIOFile.__init__(self, file_format)
Parameter.__init__(self, name, help, flag=flag, type=type, choices=choices,
required=required, group=group, display_name=display_name)
class OutputFile(Parameter, AbstractFile):
class OutputFile(Parameter, AbstractIOFile):
def __new__(self, name, help, file_format="any", default="", choices=None,
required=False, flag=None, group="default", display_name=None):
......@@ -414,7 +416,7 @@ class OutputFile(Parameter, AbstractFile):
def __init__(self, name, help, file_format="any", default="", choices=None,
required=False, flag=None, group="default", display_name=None):
AbstractFile.__init__(self, file_format)
AbstractIOFile.__init__(self, file_format)
Parameter.__init__(self, name, help, flag=flag, type="localfile", choices=choices,
required=required, group=group, display_name=display_name)
......@@ -432,7 +434,7 @@ class ParameterList(list, AbstractParameter):
return list.__init__(self, default)
class InputFileList(ParameterList, AbstractFile):
class InputFileList(ParameterList, AbstractIOFile):
def __init__(self, name, help, file_format="any", default=None, type="localfile", choices=None,
required=False, flag=None, group="default", display_name=None):
......@@ -447,7 +449,7 @@ class InputFileList(ParameterList, AbstractFile):
raise ValueError("InputFile.__new__: wrong type provided: '"+type2test+"', this should be choosen between '"
+ "', '".join(INPUTFILE_TYPES)+"'")
AbstractFile.__init__(self, file_format)
AbstractIOFile.__init__(self, file_format)
ParameterList.__init__(self, name, help, flag=flag, type=type, choices=choices,
required=required, group=group, display_name=display_name)
if default.__class__.__name__ == "str":
......@@ -458,12 +460,12 @@ class InputFileList(ParameterList, AbstractFile):
return list.__init__(self, default)
class OutputFileList(ParameterList, AbstractFile):
class OutputFileList(ParameterList, AbstractIOFile):
def __init__(self, name, help, file_format="any", default=None, choices=None,
required=False, flag=None, group="default", display_name=None):
if default == None: default = []
AbstractFile.__init__(self, file_format)
AbstractIOFile.__init__(self, file_format)
ParameterList.__init__(self, name, help, flag=flag, type="localfile", choices=choices,
required=required, group=group, display_name=display_name)
if default.__class__.__name__ == "str":
......
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