Make strtobool even more robust
If strtobool fails, return False always.
This commit is contained in:
parent
d36d8e0637
commit
ca5327b908
|
@ -50,7 +50,10 @@ def strtobool(stringv):
|
||||||
return False
|
return False
|
||||||
if isinstance(stringv, bool):
|
if isinstance(stringv, bool):
|
||||||
return bool(stringv)
|
return bool(stringv)
|
||||||
|
try:
|
||||||
return bool(dustrtobool(stringv))
|
return bool(dustrtobool(stringv))
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
# Parse the configuration file
|
# Parse the configuration file
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -38,7 +38,10 @@ def strtobool(stringv):
|
||||||
return False
|
return False
|
||||||
if isinstance(stringv, bool):
|
if isinstance(stringv, bool):
|
||||||
return bool(stringv)
|
return bool(stringv)
|
||||||
|
try:
|
||||||
return bool(dustrtobool(stringv))
|
return bool(dustrtobool(stringv))
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initialization function
|
# Initialization function
|
||||||
|
|
|
@ -47,7 +47,10 @@ def strtobool(stringv):
|
||||||
return False
|
return False
|
||||||
if isinstance(stringv, bool):
|
if isinstance(stringv, bool):
|
||||||
return bool(stringv)
|
return bool(stringv)
|
||||||
|
try:
|
||||||
return bool(dustrtobool(stringv))
|
return bool(dustrtobool(stringv))
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exceptions (used by Celery tasks)
|
# Exceptions (used by Celery tasks)
|
||||||
|
|
Loading…
Reference in New Issue