Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Mappings now deserialize None to colander.null. #54

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

jparise commented Jun 7, 2012

This makes missing= possible for mappings when the cstruct's value
is None (such as when we encounted deserialized JSON 'null' values).

@jparise jparise Mappings now deserialize None to colander.null.
This makes 'missing=' possible for mappings when the cstruct's value
is None (such as when we encounted deserialized JSON 'null' values).
1122c3e
Owner

mcdonc commented Sep 21, 2012

There are cases where this would be a validation error, aren't there? If someone supplies None in the place a mapping should be, might that not signify a data error?

jparise commented Sep 21, 2012

It's been a few months since my code base needed this change (it no longer does), but I recall this being necessary for the case where I had an optional sequence of mappings, and the sequence (if provided) had a validator rule requiring a minimum number of entries.

Owner

mcdonc commented Sep 21, 2012

OK. I'm going to close this without a merge, because I think the chance that someone might accidentally get a valid result from deserialization with bogus input outweighs the rationale. Thanks and sorry for the late response.

@mcdonc mcdonc closed this Sep 21, 2012

jparise commented Sep 21, 2012

That sounds good to me. I hadn't considered the cases you mentioned.

If you can come up with a safer way to support the scenario I described, however, it might be useful to others in the future.

Owner

mcdonc commented Sep 21, 2012

It pretty much exists, you just have to use colander.null instead of None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment