From 4c4a58e77b710509677a10a4eba6e3c212aaa3b0 Mon Sep 17 00:00:00 2001 From: "Tom X. Tobin" Date: Thu, 14 Jan 2016 12:44:05 -0500 Subject: [PATCH] osx_defaults: Fix boolean value parsing Values for boolean types were being unconditionally treated as strings (by calling `.lower()`), thus breaking value parsing for actual boolean and integer objects. It looks like the bug was introduced in: - 130bd670d82cc55fa321021e819838e07ff10c08 Fixes #709. --- system/osx_defaults.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/osx_defaults.py b/system/osx_defaults.py index 614adc4852b..98aedcbd709 100644 --- a/system/osx_defaults.py +++ b/system/osx_defaults.py @@ -124,9 +124,11 @@ class OSXDefaults(object): if type == "string": return str(value) 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 - elif value.lower() in [False, 0, "false", "0", "no"]: + elif value in [False, 0, "false", "0", "no"]: return False raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value))) elif type == "date":