oca-storage/odoo-bringout-oca-storage-fs_attachment/fs_attachment/models/strtobool.py
2025-08-29 15:43:06 +02:00

21 lines
389 B
Python

_MAP = {
"y": True,
"yes": True,
"t": True,
"true": True,
"on": True,
"1": True,
"n": False,
"no": False,
"f": False,
"false": False,
"off": False,
"0": False,
}
def strtobool(value):
try:
return _MAP[str(value).lower()]
except KeyError as e:
raise ValueError('"{}" is not a valid bool value'.format(value)) from e