Interfaces¶
- colander.interfaces.Preparer(value)¶
A preparer is called after deserialization of a value but before that value is validated.
Any modifications to
valuerequired should be made by returning the modified value rather than modifying in-place.If no modification is required, then
valueshould be returned as-is.
- colander.interfaces.Validator(node, value)¶
A validator is called after preparation of the deserialized value.
If
valueis not valid, raise acolander.Invalidinstance as an exception after.nodeis acolander.SchemaNodeinstance, for use when raising acolander.Invalidexception.
- class colander.interfaces.Type¶
- deserialize(node, cstruct)¶
Deserialze the cstruct represented by
cstructto an appstruct. The deserialization should be composed of one or more objects which can be serialized by thecolander.interfaces.Type.serialize()method of this type.nodeis acolander.SchemaNodeinstance.cstructis a cstruct.If the object cannot be deserialized for any reason, a
colander.Invalidexception should be raised.
- serialize(node, appstruct)¶
Serialize the appstruct represented by
appstructto a cstruct. The serialization should be composed of one or more objects which can be deserialized by thecolander.interfaces.Type.deserialize()method of this type.nodeis acolander.SchemaNodeinstance.appstructis an appstruct.If
appstructis the special valuecolander.null, the type should serialize a null value.If the object cannot be serialized for any reason, a
colander.Invalidexception should be raised.