Closed suvayu closed 1 year ago
from_database()
should really care about converting values from their database representation, not user input. We cannot use this function to deal with user input; we may even switch the database representation to something else than JSON in the future breaking the functionality introduced here.
We should rather deal with user input in Toolbox side, converting "true" and "false" case insensitively to Python's True
and False
in Database editor. Note, that string like yes
and no
should NOT be converted as there are Tools that require them to remain as-is.
Forgot to mention that we have an issue for this, spine-tools/Spine-Toolbox#2055
Okay, I'll close this PR then. Maybe tomorrow during the meeting you can point me to the user input code, and I can estimate the effort required for this.
Currently only
'true'
&'false'
(case sensitive) are accepted as valid booleans (as per the JSON spec). This PR adds a preprocessing step that case insensitively checks if the string/bytes value matches a boolean, if it does, it down cases the value before parsing it to a Python object.'TRUE'
,'true'
,'True'
->True
'FALSE'
,'false'
,'False'
->False
This should be merged after #235, new commits only touch
parameter_value.py
&tests/test_parameter_value.py
Checklist before merging