You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My question seems somewhat similar to other None related problems, e.g. #140, #186, #204.
It seems to me that deserializing a None string should yield the same, instead of colander.Invalid: {'name': 'Required'} which is misleading because name does indeed exist:
>>> class Person(colander.MappingSchema):
... name = colander.SchemaNode(colander.String(allow_empty=True))
>>> Person().deserialize({'name': 'foo'})
{'name': 'foo'}
>>> Person().deserialize({'name': ''})
{'name': ''}
>>> Person().deserialize({'name': None})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../python3.4/site-packages/colander/__init__.py", line 2058, in deserialize
appstruct = self.typ.deserialize(self, cstruct)
File "/.../python3.4/site-packages/colander/__init__.py", line 719, in deserialize
return self._impl(node, cstruct, callback)
File "/.../python3.4/site-packages/colander/__init__.py", line 699, in _impl
raise error
colander.Invalid: {'name': 'Required'}
A proposed solution can be found on Stackoverflow but it seems more like a workaround for this issue than a proper solution.
The text was updated successfully, but these errors were encountered:
jenstroeger
changed the title
Allow None value for strings
Allow None value for strings
Oct 18, 2016
My question seems somewhat similar to other
None
related problems, e.g. #140, #186, #204.It seems to me that deserializing a
None
string should yield the same, instead ofcolander.Invalid: {'name': 'Required'}
which is misleading becausename
does indeed exist:A proposed solution can be found on Stackoverflow but it seems more like a workaround for this issue than a proper solution.
The text was updated successfully, but these errors were encountered: