Handle None in to_bool utility

None is commonly used, so we want to be able to handle it with this helper.
Found with a test case.
This commit is contained in:
Grigori Goronzy 2017-09-01 23:59:05 +02:00
parent cf68e3c6dc
commit 53184b549e

View File

@ -29,6 +29,8 @@ class Utils:
def to_bool(cls, val):
"""make sensible boolean from string or other type value"""
if val is None:
return False
if isinstance(val, bool):
return val
elif isinstance(val, int):