diff --git a/redash/settings/helpers.py b/redash/settings/helpers.py index 2f3f2f657a..98946d81e4 100644 --- a/redash/settings/helpers.py +++ b/redash/settings/helpers.py @@ -1,5 +1,4 @@ import os -import simplejson def fix_assets_path(path): @@ -19,8 +18,15 @@ def set_from_string(s): return set(array_from_string(s)) -def parse_boolean(str): - return simplejson.loads(str.lower()) +def parse_boolean(s): + """Takes a string and returns the equivalent as a boolean value.""" + s = s.strip().lower() + if s in ('yes', 'true', 'on', '1'): + return True + elif s in ('no', 'false', 'off', '0', 'none'): + return False + else: + raise ValueError('Invalid boolean value %r' % s) def int_or_none(value):