Add case insensitive testing to boolean string validation.
This commit is contained in:
parent
eb415d7b96
commit
cbe9a7d2a3
2 changed files with 16 additions and 0 deletions
|
@ -23,6 +23,7 @@ longitude = vol.All(vol.Coerce(float), vol.Range(min=-180, max=180),
|
|||
def boolean(value):
|
||||
"""Validate and coerce a boolean value."""
|
||||
if isinstance(value, str):
|
||||
value = value.lower()
|
||||
if value in ('1', 'true', 'yes', 'on', 'enable'):
|
||||
return True
|
||||
if value in ('0', 'false', 'no', 'off', 'disable'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue