Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class NotAnIterator(ValidationError):
__doc__ = _("""Not an iterator""")
def __init__(self, value):
super().__init__(value=value)
class WrongContainedType(ValidationError):
__doc__ = _("""Wrong contained type""")
def __init__(self, errors, field_name):
super().__init__(field_name=field_name, errors=errors)
class NotUnique(ValidationError):
__doc__ = _("""One or more entries of sequence are not unique.""")
class SchemaNotFullyImplemented(ValidationError):
__doc__ = _("""Schema not fully implemented""")
class SchemaNotProvided(ValidationError):
__doc__ = _("""Schema not provided""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class InvalidURI(ValidationError):
__doc__ = _("""The specified URI is not valid.""")
class ILen(IField):
"""A Field requiring its value to have a length.
The value needs to have a conventional __len__ method.
"""
class IMinMax(IOrderable):
"""Field requiring its value to be between min and max.
This implies that the value needs to support the IOrderable interface.
"""
min = Field(title=_("Start of the range"), required=False, default=None)
max = Field(title=_("End of the range (including the value itself)"), required=False, default=None)
class IMinMaxLen(ILen):
"""Field requiring the length of its value to be within a range"""
min_length = Int(
title=_("Minimum length"),
description=_(
"""
Value after whitespace processing cannot have less than
`min_length` characters (if a string type) or elements (if
another sequence type). If `min_length` is ``None``, there is
no minimum.
"""
"""Field containing an Object value."""
schema = Attribute("schema", _("The Interface that defines the Fields comprising the Object."))
class IDict(IMinMaxLen, IIterable, IContainer):
"""Field containing a conventional dict.
The key_type and value_type fields allow specification
of restrictions for keys and values contained in the dict.
"""
key_type = Attribute("key_type", _("Field keys must conform to the given type, expressed via a Field."))
value_type = Attribute(
"value_type", _("Field values must conform to the given type, expressed " "via a Field.")
)
class ITerm(Interface):
"""Object representing a single value in a vocabulary."""
value = Attribute("value", "The value used to represent vocabulary term in a field.")
class ITokenizedTerm(ITerm):
"""Object representing a single value in a tokenized vocabulary.
"""
# Should be a ``guillotina.schema.ASCIILine``, but `ASCIILine` is not a bootstrap
# field.
token = Attribute(
__doc__ = _("""One or more entries of sequence are not unique.""")
class SchemaNotFullyImplemented(ValidationError):
__doc__ = _("""Schema not fully implemented""")
class SchemaNotProvided(ValidationError):
__doc__ = _("""Schema not provided""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class InvalidURI(ValidationError):
__doc__ = _("""The specified URI is not valid.""")
class InvalidId(ValidationError):
__doc__ = _("""The specified id is not valid.""")
class InvalidDottedName(ValidationError):
__doc__ = _("""The specified dotted name is not valid.""")
class Unbound(Exception):
__doc__ = _("""The field is not bound.""")
class TooShort(ValidationError):
__doc__ = _("""Value is too short""")
def __init__(self, value, constraint, field_name=""):
super().__init__(value=value, constraint=constraint, field_name=field_name)
class InvalidValue(ValidationError):
__doc__ = _("""Invalid value""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class ConstraintNotSatisfied(ValidationError):
__doc__ = _("""Constraint not satisfied""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class NotAContainer(ValidationError):
__doc__ = _("""Not a container""")
def __init__(self, value):
super().__init__(value=value)
class NotAnIterator(ValidationError):
__doc__ = _("""Not an iterator""")
def __init__(self, value):
class TooBig(ValidationError):
__doc__ = _("""Value is too big""")
def __init__(self, value, constraint, field_name=""):
super().__init__(value=value, constraint=constraint, field_name=field_name)
class TooSmall(ValidationError):
__doc__ = _("""Value is too small""")
def __init__(self, value, constraint, field_name=""):
super().__init__(value=value, constraint=constraint, field_name=field_name)
class TooLong(ValidationError):
__doc__ = _("""Value is too long""")
def __init__(self, value, constraint, field_name=""):
super().__init__(value=value, constraint=constraint, field_name=field_name)
class TooShort(ValidationError):
__doc__ = _("""Value is too short""")
def __init__(self, value, constraint, field_name=""):
super().__init__(value=value, constraint=constraint, field_name=field_name)
class InvalidValue(ValidationError):
__doc__ = _("""Invalid value""")
def __init__(self, value, field_name):
super().__init__(value=value)
class WrongContainedType(ValidationError):
__doc__ = _("""Wrong contained type""")
def __init__(self, errors, field_name):
super().__init__(field_name=field_name, errors=errors)
class NotUnique(ValidationError):
__doc__ = _("""One or more entries of sequence are not unique.""")
class SchemaNotFullyImplemented(ValidationError):
__doc__ = _("""Schema not fully implemented""")
class SchemaNotProvided(ValidationError):
__doc__ = _("""Schema not provided""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class InvalidURI(ValidationError):
__doc__ = _("""The specified URI is not valid.""")
class InvalidId(ValidationError):
__doc__ = _("""The specified id is not valid.""")
description=_(
"""
Value after whitespace processing cannot have less than
`min_length` characters (if a string type) or elements (if
another sequence type). If `min_length` is ``None``, there is
no minimum.
"""
),
required=False,
min=0, # needs to be a positive number
default=0,
)
max_length = Int(
title=_("Maximum length"),
description=_(
"""
Value after whitespace processing cannot have greater
or equal than `max_length` characters (if a string type) or
elements (if another sequence type). If `max_length` is
``None``, there is no maximum."""
),
required=False,
min=0, # needs to be a positive number
default=None,
)
class IInterfaceField(IField):
"""Fields with a value that is an interface (implementing
zope.interface.Interface)."""
__doc__ = _("""Schema not fully implemented""")
class SchemaNotProvided(ValidationError):
__doc__ = _("""Schema not provided""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class InvalidURI(ValidationError):
__doc__ = _("""The specified URI is not valid.""")
class InvalidId(ValidationError):
__doc__ = _("""The specified id is not valid.""")
class InvalidDottedName(ValidationError):
__doc__ = _("""The specified dotted name is not valid.""")
class Unbound(Exception):
__doc__ = _("""The field is not bound.""")
class InvalidValue(ValidationError):
__doc__ = _("""Invalid value""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class ConstraintNotSatisfied(ValidationError):
__doc__ = _("""Constraint not satisfied""")
def __init__(self, value, field_name):
super().__init__(value=value, field_name=field_name)
class NotAContainer(ValidationError):
__doc__ = _("""Not a container""")
def __init__(self, value):
super().__init__(value=value)
class NotAnIterator(ValidationError):
__doc__ = _("""Not an iterator""")
def __init__(self, value):
super().__init__(value=value)
class WrongContainedType(ValidationError):
__doc__ = _("""Wrong contained type""")
def __init__(self, errors, field_name):