Files
deb-python-colander/docs/api.rst

3.2 KiB

Colander API

Exceptions

colander

Invalid

pos

An integer representing the position of this exception's schema node relative to all other child nodes of this exception's parent schema node. For example, if this exception is related to the third child node of its parent's schema, pos might be the integer 3. pos may also be None, in which case this exception is the root exception.

children

A list of child exceptions. Each element in this list (if any) will also be an colander.Invalid exception, recursively, representing the error circumstances for a particular schema deserialization.

msg

A str or unicode object, or a translation string instance representing a freeform error value set by a particular type during an unsuccessful deserialization. If this exception is only structural (only exists to be a parent to some inner child exception), this value will be None.

node

The schema node to which this exception relates.

value

An attribute not used internally by Colander, but which can be used by higher-level systems to attach arbitrary values to Colander exception nodes. For example, In the system named Deform, which uses Colander schemas to define HTML form renderings, the value is used when raising an exception from a widget as the value which should be redisplayed when an error is shown.

Validators

All

Any

Range

Length

OneOf

ContainsOnly

Function

Regex

Email

luhnok

url

A validator which ensures the value is a URL (via regex).

Types

Mapping

Tuple

Set

List

Sequence

Seq

String

Str

Integer

Int

Float

Decimal

Boolean

Bool

GlobalObject

DateTime

Date

Time

SchemaNode

__delitem__

__getitem__

__iter__

Schema

MappingSchema

TupleSchema

SequenceSchema

deferred

instantiate

null

Represents a null value in colander-related operations.

required

Represents a required value in colander-related operations.

drop

Represents a value that will be dropped from the schema if it is missing during deserialization. Passed as a value to the missing keyword argument of SchemaNode.