/usr/share/pyshared/zope/schema/_bootstrapinterfaces.py is in python-zope.schema 3.7.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bootstrap schema interfaces and exceptions
"""
import zope.interface
from zope.schema._messageid import _
class StopValidation(Exception):
"""Raised if the validation is completed early.
Note that this exception should be always caught, since it is just
a way for the validator to save time.
"""
class ValidationError(zope.interface.Invalid):
"""Raised if the Validation process fails."""
def doc(self):
return self.__class__.__doc__
def __cmp__(self, other):
if not hasattr(other, 'args'):
return -1
return cmp(self.args, other.args)
def __repr__(self):
return '%s(%s)' % (self.__class__.__name__,
', '.join(repr(arg) for arg in self.args))
class RequiredMissing(ValidationError):
__doc__ = _("""Required input is missing.""")
class WrongType(ValidationError):
__doc__ = _("""Object is of wrong type.""")
class TooBig(ValidationError):
__doc__ = _("""Value is too big""")
class TooSmall(ValidationError):
__doc__ = _("""Value is too small""")
class TooLong(ValidationError):
__doc__ = _("""Value is too long""")
class TooShort(ValidationError):
__doc__ = _("""Value is too short""")
class InvalidValue(ValidationError):
__doc__ = _("""Invalid value""")
class ConstraintNotSatisfied(ValidationError):
__doc__ = _("""Constraint not satisfied""")
class NotAContainer(ValidationError):
__doc__ = _("""Not a container""")
class NotAnIterator(ValidationError):
__doc__ = _("""Not an iterator""")
class IFromUnicode(zope.interface.Interface):
"""Parse a unicode string to a value
We will often adapt fields to this interface to support views and
other applications that need to conver raw data as unicode
values.
"""
def fromUnicode(str):
"""Convert a unicode string to a value.
"""
|