-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boolean type should fallback to False instead of True!!! #250
Comments
Please create a PR with tests and sign CONTRIBUTORS.txt if you haven't, and we can pull it into colander! |
Not to be too pedantic but I don't think that's actually in the definition of a boolean. I can't find anything about what the default should be on wikipedia. Most values actually default to ANYWAY I'm not against changing this, but someone who cares (you) will need to submit a PR with tests as Bret said. :-) |
Looking at the source for
So, because the default for false values is 'false' or 0, Like most of colander, it's probably a good idea to translate |
I will submit a PR soon... |
@daveoncode why not add For example:
In the code sample you supplied in |
this is very surprising behavior that just bit me in the ass in production no less. |
If I deserialize a dictionary containing
None
as value for a boolean node, Colander falls back toTrue
, which is absolutely wrong... a default for a boolean must always beFalse
by definition.I currently subclassed
Boolean
in this way to make it work as expected:But I hope you will consider to replace
True
withFalse
in the last line of originalBoolean
deserialize()
method. Thanks!The text was updated successfully, but these errors were encountered: