Edit me on GitHub

Interfaces

colander.interfaces.Preparer(value)

A preparer is called after deserialization of a value but before that value is validated.

Any modifications to value required should be made by returning the modified value rather than modifying in-place.

If no modification is required, then value should be returned as-is.

colander.interfaces.Validator(node, value)

A validator is called after preparation of the deserialized value.

If value is not valid, raise a colander.Invalid instance as an exception after.

node is a colander.SchemaNode instance, for use when raising a colander.Invalid exception.

class colander.interfaces.Type
deserialize(node, cstruct)

Deserialze the cstruct represented by cstruct to an appstruct. The deserialization should be composed of one or more objects which can be serialized by the colander.interfaces.Type.serialize() method of this type.

node is a colander.SchemaNode instance.

cstruct is a cstruct.

If the object cannot be deserialized for any reason, a colander.Invalid exception should be raised.

serialize(node, appstruct)

Serialize the appstruct represented by appstruct to a cstruct. The serialization should be composed of one or more objects which can be deserialized by the colander.interfaces.Type.deserialize() method of this type.

node is a colander.SchemaNode instance.

appstruct is an appstruct.

If appstruct is the special value colander.null, the type should serialize a null value.

If the object cannot be serialized for any reason, a colander.Invalid exception should be raised.

Previous topic

Manipulating Data Structures

Next topic

Colander API