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__
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)
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)
class RestrictionErrorList(ValueErrorList): message = builtins._st("Exceptions.RestrictionErrorList")
class ToiRefMapValueError(ValueTypeError): message = builtins._st("Illegal ToiRefMap value: %(value)r")
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)
class RelationError(ToiTypeError): message = builtins._st("Exceptions.RelationError")
class QualificationError(RestrictionError): message = builtins._st("Exceptions.QualificationError")
class SelectionError(RestrictionError): message = builtins._st("Exceptions.SelectionError")
class RangeHighError(RestrictionError): message = builtins._st("Exceptions.RangeHighError")
class BlobValueError(ValueTypeError): message = builtins._st("Exceptions.BlobValueError")
class AttrPermError(CapsAttributeError): """ Permission was denied for the attempted action. """ message = builtins._st( "Exceptions.AttrPermError %(name)s: '%(toc)s(%(toid)s)'")
class AttrNameError(CapsAttributeError, AttributeError): """ The attribute wasn't found (probably a typo). """ message = builtins._st( "Exceptions.AttrNameError %(name)s: '%(toc)s(%(toid)s)'")
class QuantityMaxError(RestrictionError): message = builtins._st("Exceptions.QuantityMaxError")
class DecimalValueError(ValueTypeError): message = builtins._st("Exceptions.DecimalValueError")
class NonDistinctError(RestrictionError): message = builtins._st("Exceptions.NonDistinctError")
class EnumValueError(ValueTypeError): message = builtins._st("Exceptions.EnumValueError")
class ResolutionError(RestrictionError): message = builtins._st("Exceptions.ResolutionError")
class IntValueError(ValueTypeError): message = builtins._st("Exceptions.IntValueError")
class SizeLongError(RestrictionError): message = builtins._st("Exceptions.SizeLongError")
class StringValueError(ValueTypeError): message = builtins._st("Exceptions.StringValueError")
class ToiTypeError(RestrictionError): message = builtins._st("Exceptions.ToiTypeError")
class TimestampValueError(ValueTypeError): message = builtins._st("Exceptions.TimestampValueError")
class UniqueError(RestrictionError): message = builtins._st("Exceptions.UniqueError")
class ToiNonexistantError(CapsToiError): message = builtins._st( "Exceptions.ToiNonexistantError '%(toc)s(%(toid)s)'")