nti.schema.interfaces¶
Interfaces describing the events and fields this package uses.
Also utility functions.
-
class
BeforeCollectionAssignedEvent
(obj, name, context)[source]¶ Bases:
nti.schema.interfaces.BeforeSchemaFieldAssignedEvent
-
object
= None¶
-
-
interface
IBeforeCollectionAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeIterableAssignedEvent
Event for assigning collections.
-
object
¶ The collection being assigned. May or may not be mutable.
-
-
interface
IBeforeContainerAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeSchemaFieldAssignedEvent
Event for assigning containers (__contains__).
-
interface
IBeforeDictAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeIterableAssignedEvent
Event for assigning dicts.
-
interface
IBeforeIterableAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeContainerAssignedEvent
Event for assigning iterables.
-
interface
IBeforeSchemaFieldAssignedEvent
[source]¶ An event sent when certain schema fields will be assigning an object to a property of another object.
The interface
zope.schema.interfaces.IBeforeObjectAssignedEvent
is a sub-interface of this one once this module is imported.-
object
¶ The object that is going to be assigned. Subscribers may modify this
-
name
¶ The name of the attribute under which the object will be assigned.
-
context
¶ The context object where the object will be assigned to.
-
-
interface
IBeforeSequenceAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeCollectionAssignedEvent
Event for assigning sequences.
-
object
¶ The sequence being assigned. May or may not be mutable.
-
-
interface
IBeforeSetAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeCollectionAssignedEvent
Event for assigning sets.
-
interface
IBeforeTextAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeSchemaFieldAssignedEvent
Event for assigning text.
-
object
¶ The text being assigned.
Implementation: zope.schema.Text
Read Only: False Required: True Default Value: None Allowed Type: unicode
-
-
interface
IBeforeTextLineAssignedEvent
[source]¶ Extends:
nti.schema.interfaces.IBeforeTextAssignedEvent
Event for assigning text lines.
-
object
¶ The text being assigned.
Implementation: zope.schema.TextLine
Read Only: False Required: True Default Value: None Allowed Type: unicode
-
-
interface
IFromObject
[source]¶ Something that can convert one type of object to another, following validation rules (see
zope.schema.interfaces.IFromUnicode
)-
fromObject
(obj)¶ Attempt to convert the object to the required type following the rules of this object. Raises a TypeError or
zope.schema.interfaces.ValidationError
if this isn’t possible.
-
-
interface
ISchemaConfigured
[source]¶ marker interface for
SchemaConfigured
classes.Used to facilitate the registration of forms and views.
-
interface
IVariant
[source]¶ Extends:
zope.schema.interfaces.IField
,nti.schema.interfaces.IFromObject
Similar to
zope.schema.interfaces.IObject
, but representing one of several different types.If
fromObject()
orvalidate()
fails, it should raise aVariantValidationError
.
-
exception
VariantValidationError
(field, value, errors)[source]¶ Bases:
zope.schema._bootstrapinterfaces.ValidationError
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.New 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 byext_self
and return that. Always returns at leastiface_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 callszope.schema.interfaces.ValidationError.with_field_and_value()
before returning the exception. You should always catchzope.schema.interfaces.InvalidValue
.