Make strtobool even more robust

If strtobool fails, return False always.
This commit is contained in:
Joshua Boniface 2020-03-09 09:30:16 -04:00
parent d36d8e0637
commit ca5327b908
3 changed files with 12 additions and 3 deletions

View File

@ -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:

View File

@ -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

View File

@ -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)