colander icon indicating copy to clipboard operation
colander copied to clipboard

A serialization/deserialization/validation library for strings, mappings and lists.

Results 49 colander issues
Sort by recently updated
recently updated
newest added

``` python def MyMappingValidator(node, value): raise colander.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...

e.g. ``` python class Data(colander.MappingSchema): name = colander.SchemaNode(colander.Str(), missing='', default='') ``` works as expected on deserialization, but not on serialization, where the node becomes null instead of ''.

Hope to have the ability to set the error message.

The serialization of `None` is very inconsistent since 1.0b1, because #513d860 reverted part of the special cases for `None`: - `String`: `"None"` - `Boolean`: `False` - `Date`, `Time`, `DateTime`: `null`...

Take a look at `__call__` methods of Range validator: ``` if self.min is not None: if value < self.min: min_err = _(self.min_err, mapping={'val':value, 'min':self.min}) raise Invalid(node, min_err) ``` Shoudn't there...

bug
sprintable

Proposing that we create an exception that can be raised in a validator, which indicates an Invalid state AND stops the validation chain. I have something hacked together which accomplishes...

I'd like to use Colander to validate input into an API, and it'd be useful to differentiate errors without resorting to brittle things like inspecting the error message. Colander appears...

The `SchemaNode` is clearly expecting types to have `flatten` and `unflatten` methods. https://github.com/Pylons/colander/blob/master/colander/__init__.py#L1876 I'm assuming this was added without updating the documentation. Also `cstruct_children` is required yet missing. Finally, is...

In colander/__init__.py:405-412 (class Mapping(SchemaType)) there's this validation procedure: ``` def _validate(self, node, value): try: return dict(value) except Exception, e: raise Invalid(…) ``` The problem is that dict.__init__ will convert to...

enhancement
sprintable

I'm following the `RangedIntSchemaNode` example under [Subclassing SchemaNode](http://docs.pylonsproject.org/projects/colander/en/latest/basics.html#subclassing-schemanode) and it works (provided you add a `schema_type` class attribute), but I can't get it to work for sequences. For example: ```...

enhancement
sprintable