Exemple #1
0
class ValueErrorList(LocalisedError):
    """
    The value for this attribute was incorrect. self.args is a list of
    tuples (i, e), where i is the index in the value list and e is the
    error raised for that value.
    """
    message = builtins._st("Exceptions.ValueErrorList")

    def xlat(self, tfunc):
        return ', '.join(
            ['%d: %s' % (i, x.xlat(tfunc)) for (i, x) in self.args])

    def __str__(self):
        return ' [' + ', '.join(
            ['%d %s' % (i, repr(x)) for (i, x) in self.args]) + ']'

    __repr__ = __str__
Exemple #2
0
class AttrErrorList(LocalisedError):
    """
    Wraps a list of attribute errors.
    """
    message = builtins._st("Exceptions.AttrErrorList %(errors)s")

    def __init__(self, *args):
        if len(args) == 1 and isinstance(args[0], (list, tuple)):
            args = args[0]
        LocalisedError.__init__(self, *args)
        self.t = {}
        self.nt = {}
        if len(args):
            self.t.update(args[0].t)
            self.nt.update(args[0].nt)

    def xlat(self, tfunc):
        self.nt['errors'] = '\n'.join([e.xlat(tfunc) for e in self.args])
        return LocalisedError.xlat(self, tfunc)
Exemple #3
0
class AttrValueError(CapsAttributeError):
    """
    The value for this attribute was incorrect. The last element in
    self.args should be the error.
    """
    message = builtins._st("Exceptions.AttrValueError %(name)s: %(error)s")

    def xlat(self, tfunc):
        """
        Translate the contained error and run normal translation.
        """
        if self.args:
            # The last element in self.args should be the error.
            error = self.args[-1]
            if isinstance(error, LocalisedError):
                err = error.xlat(tfunc)
            else:
                err = repr(error)
            self.nt['error'] = err
        return CapsAttributeError.xlat(self, tfunc)
Exemple #4
0
class RestrictionErrorList(ValueErrorList):
    message = builtins._st("Exceptions.RestrictionErrorList")
Exemple #5
0
class ToiRefMapValueError(ValueTypeError):
    message = builtins._st("Illegal ToiRefMap value: %(value)r")
Exemple #6
0
class ToiDeletedError(ToiNonexistantError):
    message = builtins._st("Exceptions.ToiDeletedError '%(toc)s(%(toid)s)'")

    def __init__(self, tocname, toid, *args):
        self.t = {'toc': tocname, 'toid': toid}
        ToiNonexistantError.__init__(self, tocname, toid, *args)
Exemple #7
0
class RelationError(ToiTypeError):
    message = builtins._st("Exceptions.RelationError")
Exemple #8
0
class QualificationError(RestrictionError):
    message = builtins._st("Exceptions.QualificationError")
Exemple #9
0
class SelectionError(RestrictionError):
    message = builtins._st("Exceptions.SelectionError")
Exemple #10
0
class RangeHighError(RestrictionError):
    message = builtins._st("Exceptions.RangeHighError")
Exemple #11
0
class BlobValueError(ValueTypeError):
    message = builtins._st("Exceptions.BlobValueError")
Exemple #12
0
class AttrPermError(CapsAttributeError):
    """
    Permission was denied for the attempted action.
    """
    message = builtins._st(
        "Exceptions.AttrPermError %(name)s: '%(toc)s(%(toid)s)'")
Exemple #13
0
class AttrNameError(CapsAttributeError, AttributeError):
    """
    The attribute wasn't found (probably a typo).
    """
    message = builtins._st(
        "Exceptions.AttrNameError %(name)s: '%(toc)s(%(toid)s)'")
Exemple #14
0
class QuantityMaxError(RestrictionError):
    message = builtins._st("Exceptions.QuantityMaxError")
Exemple #15
0
class DecimalValueError(ValueTypeError):
    message = builtins._st("Exceptions.DecimalValueError")
Exemple #16
0
class NonDistinctError(RestrictionError):
    message = builtins._st("Exceptions.NonDistinctError")
Exemple #17
0
class EnumValueError(ValueTypeError):
    message = builtins._st("Exceptions.EnumValueError")
Exemple #18
0
class ResolutionError(RestrictionError):
    message = builtins._st("Exceptions.ResolutionError")
Exemple #19
0
class IntValueError(ValueTypeError):
    message = builtins._st("Exceptions.IntValueError")
Exemple #20
0
class SizeLongError(RestrictionError):
    message = builtins._st("Exceptions.SizeLongError")
Exemple #21
0
class StringValueError(ValueTypeError):
    message = builtins._st("Exceptions.StringValueError")
Exemple #22
0
class ToiTypeError(RestrictionError):
    message = builtins._st("Exceptions.ToiTypeError")
Exemple #23
0
class TimestampValueError(ValueTypeError):
    message = builtins._st("Exceptions.TimestampValueError")
Exemple #24
0
class UniqueError(RestrictionError):
    message = builtins._st("Exceptions.UniqueError")
Exemple #25
0
class ToiNonexistantError(CapsToiError):
    message = builtins._st(
        "Exceptions.ToiNonexistantError '%(toc)s(%(toid)s)'")