Commit 529987bf authored by Jerome Mariette's avatar Jerome Mariette
Browse files

add some builtin function definition to handle None values

parent eddd288f
......@@ -379,7 +379,22 @@ class Parameter(str, AbstractParameter):
def __new__(self, name, help, default="", type=types.StringType, choices=None, required=False,
flag=None, sub_parameters=None, group="default", display_name=None):
return str.__new__(self, default)
def __eq__(self, other):
if other.__class__.__name__ == "NoneType":
return self == 'None'
else: return str.__eq__(self, other)
def __ne__(self, other):
if other.__class__.__name__ == "NoneType":
return self != 'None'
else: return str.__ne__(self, other)
def __nonzero__(self):
if self == None or self == 'None':
return False
else: return True
def __init__(self, name, help, default="", type=types.StringType, choices=None, required=False,
flag=None, sub_parameters=None, group="default", display_name=None):
AbstractParameter.__init__(self, name, help, flag=flag, default=default, type=type, choices=choices, required=required,
......
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