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:
parent
cf68e3c6dc
commit
53184b549e
@ -29,6 +29,8 @@ class Utils:
|
|||||||
def to_bool(cls, val):
|
def to_bool(cls, val):
|
||||||
"""make sensible boolean from string or other type value"""
|
"""make sensible boolean from string or other type value"""
|
||||||
|
|
||||||
|
if val is None:
|
||||||
|
return False
|
||||||
if isinstance(val, bool):
|
if isinstance(val, bool):
|
||||||
return val
|
return val
|
||||||
elif isinstance(val, int):
|
elif isinstance(val, int):
|
||||||
|
Loading…
Reference in New Issue
Block a user