diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2014-08-25 10:43:50 -0400 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2014-08-25 10:43:50 -0400 |
commit | ed661f74428670df810d4d702cd31c760693b455 (patch) | |
tree | a5d6868d5090bfaad673721c208f7baec796fc7b /markdown/util.py | |
parent | d7e0f99babd33700aa02edd4760deab800c8b5b1 (diff) | |
download | markdown-ed661f74428670df810d4d702cd31c760693b455.tar.gz markdown-ed661f74428670df810d4d702cd31c760693b455.tar.bz2 markdown-ed661f74428670df810d4d702cd31c760693b455.zip |
Fixed a bug in markdown.util.parseBoolValue
A couple scenarios with "None" were previously not accounted for.
Also updated tests which guives us 100% for markdown/util.py
Diffstat (limited to 'markdown/util.py')
-rw-r--r-- | markdown/util.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/markdown/util.py b/markdown/util.py index d5deaba..0541e7b 100644 --- a/markdown/util.py +++ b/markdown/util.py @@ -95,12 +95,12 @@ def parseBoolValue(value, fail_on_errors=True, preserve_none=False): if preserve_none and value is None: return value return bool(value) + elif preserve_none and value.lower() == 'none': + return None elif value.lower() in ('true', 'yes', 'y', 'on', '1'): return True - elif value.lower() in ('false', 'no', 'n', 'off', '0'): + elif value.lower() in ('false', 'no', 'n', 'off', '0', 'none'): return False - elif preserve_none and value.lower() == 'none': - return None elif fail_on_errors: raise ValueError('Cannot parse bool value: %r' % value) |