nti.schema.interfaces

Interfaces describing the events and fields this package uses.

Also utility functions.

class BeforeCollectionAssignedEvent(obj, name, context)[source]
object = None
class BeforeDictAssignedEvent(obj, name, context)[source]
class BeforeSchemaFieldAssignedEvent(obj, name, context)[source]
class BeforeSequenceAssignedEvent(obj, name, context)[source]
class BeforeSetAssignedEvent(obj, name, context)[source]
class BeforeTextAssignedEvent(obj, name, context)[source]
class BeforeTextLineAssignedEvent(obj, name, context)[source]
exception VariantValidationError(field, value, errors)[source]

An error raised when a value is not suitable for any of the fields of the variant.

The errors attribute is an ordered sequence of validation errors, with one raised by each field of the variant in turn.

Added in version 1.8.0.

errors = ()

A sequence of validation errors

find_most_derived_interface(ext_self, iface_upper_bound, possibilities=None)[source]

Search for the most derived version of the interface iface_upper_bound implemented by ext_self and return that. Always returns at least iface_upper_bound

Parameters:

possibilities – An iterable of schemas to consider. If not given, all the interfaces provided by ext_self will be considered.

exception InvalidValue(*args, field=None, value=None)[source]

Adds a field specifically to carry the value that is invalid.

Deprecated since version 1.4.0: This is now just a convenience wrapper around zope.schema.interfaces.InvalidValue that calls zope.schema.interfaces.ValidationError.with_field_and_value() before returning the exception. You should always catch zope.schema.interfaces.InvalidValue.