Merge pull request #1501 from tomxtobin/fix-709-boolean-values
osx_defaults: Fix boolean value parsing
This commit is contained in:
commit
90db7af7a7
1 changed files with 4 additions and 2 deletions
|
@ -124,9 +124,11 @@ class OSXDefaults(object):
|
||||||
if type == "string":
|
if type == "string":
|
||||||
return str(value)
|
return str(value)
|
||||||
elif type in ["bool", "boolean"]:
|
elif type in ["bool", "boolean"]:
|
||||||
if value.lower() in [True, 1, "true", "1", "yes"]:
|
if isinstance(value, basestring):
|
||||||
|
value = value.lower()
|
||||||
|
if value in [True, 1, "true", "1", "yes"]:
|
||||||
return True
|
return True
|
||||||
elif value.lower() in [False, 0, "false", "0", "no"]:
|
elif value in [False, 0, "false", "0", "no"]:
|
||||||
return False
|
return False
|
||||||
raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value)))
|
raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value)))
|
||||||
elif type == "date":
|
elif type == "date":
|
||||||
|
|
Loading…
Reference in a new issue