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
defMyMappingValidator(node, value):
raisecolander.Invalid(node['foo'], 'value must be less than 50')
schema=colander.SchemaNode(
colander.Sequence(),
colander.SchemaNode(
colander.Mapping(),
colander.SchemaNode(colander.Integer(), name='foo'),
validator=MyMappingValidator,
),
)
schema.deserialize([{'foo': 100}])
Results in the following traceback:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/michael/work/scratch/eggs/colander-1.0b1-py2.7.egg/colander/__init__.py", line 1917, in deserialize
appstruct = self.typ.deserialize(self, cstruct)
File "/Users/michael/scratch/eggs/colander-1.0b1-py2.7.egg/colander/__init__.py", line 988, in deserialize
return self._impl(node, cstruct, callback, accept_scalar)
File "/Users/michael/scratch/eggs/colander-1.0b1-py2.7.egg/colander/__init__.py", line 930, in _impl
raise error
Invalid: {'0': 'value must be less than 50'}
Whereas if I put the validator on the node itself, the error message path properly indicates {'0.foo': 'value must be less than 50'}. Please ignore the simplicity of the example, the actual use case is for a validator that checks the subnodes based on other subnodes and the error messages do not come out correct right now.
The text was updated successfully, but these errors were encountered:
Results in the following traceback:
Whereas if I put the validator on the node itself, the error message path properly indicates
{'0.foo': 'value must be less than 50'}
. Please ignore the simplicity of the example, the actual use case is for a validator that checks the subnodes based on other subnodes and the error messages do not come out correct right now.The text was updated successfully, but these errors were encountered: