@@ -92,8 +92,10 @@ def critical(self, message):
92
92
93
93
def to_bool (value ):
94
94
"""Converts 'something' to boolean. Raises exception for invalid formats
95
- Possible True values: 1, True, "1", "TRue", "yes", "y", "t"
96
- Possible False values: 0, False, None, [], {}, "", "0", "faLse", "no", "n", "f", 0.0, ..."""
95
+ Possible True values: 1, True, "1", "TRue", "yes", "y", "t"
96
+ Possible False values: 0, False, None, [], {}, "", "0", "faLse", "no", "n", "f", 0.0, ..."""
97
+ if value is None :
98
+ return False
97
99
if str (value ).lower () in ("yes" , "y" , "true" , "t" , "1" ):
98
100
return True
99
101
if str (value ).lower () in ("no" , "n" , "false" , "f" , "0" , "0.0" , "" , "none" , "[]" , "{}" ):
@@ -102,11 +104,15 @@ def to_bool(value):
102
104
103
105
def to_list (value ):
104
106
""" Create an array from any kind of object """
107
+ if value is None :
108
+ return []
105
109
initial_list = [x .strip () for x in value .translate (None , '!@#$[]{}\' "' ).split (',' )]
106
110
return [x for x in initial_list if x ]
107
111
108
112
def to_dict (value ):
109
113
""" Create a dictionary from any kind of incoming object """
114
+ if value is None :
115
+ return {}
110
116
if isinstance (value , dict ):
111
117
myreturn = value
112
118
else :
0 commit comments