You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
377 B
15 lines
377 B
5 years ago
|
""" Helper utilities. """
|
||
|
|
||
|
# ---------------------------------------------------------------------
|
||
|
|
||
|
def to_bool( val ):
|
||
|
"""Interpret a value as a boolean."""
|
||
|
if val is None:
|
||
|
return None
|
||
|
val = str( val ).lower()
|
||
|
if val in ["yes","true","enabled","1"]:
|
||
|
return True
|
||
|
if val in ["no","false","disabled","0"]:
|
||
|
return False
|
||
|
return None
|