Commit 0a338ef8 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix a bug with bool types

parent e751b9a6
......@@ -271,13 +271,14 @@ class AbstractParameter(object):
today = datetime.date.today()
self.default = today.strftime('%d/%m/%Y')
elif self.type == types.BooleanType :
if self.default: self.default = str(self.default).lower() in ("true", "t", "1")
else: self.default = True
if self.default.__class__.__name__ == "str":
if self.default: self.default = str(self.default).lower() in (True, "true", "t", "1")
else: self.default = True
elif self.action == "append":
self.default = []
def export_to_argparse(self):
if self.type == types.BooleanType and str(self.default).lower() in ("false", "f", "0"):
if self.type == types.BooleanType and str(self.default).lower() in (False, "false", "f", "0"):
return {"help": self.help, "required": self.required, "dest": self.name,
"default": False, "action": "store_true"}
elif self.type == types.BooleanType:
......
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