Files
deb-python-colander/docs/api.rst
Michael Merickel 666d89af4c Merge branch 'extra-value-exc' of surabujin/colander into pr/241
Renamed UnknownItemsError to UnsupportedFields.
2016-01-16 15:29:04 -06:00

3.4 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.

UnsupportedFields

fields

The dict with all detected extra fields and their values.

Nodes that contain extra fields can be located by the position of this exception in the exception tree hierarchy.

UnboundDeferredError

Validators

All

Any

Range

Length

OneOf

NoneOf

ContainsOnly

Function

Regex

Email

luhnok

url

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

uuid

A UUID hexadecimal string validator via regular expression using colander.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

required

drop