Relax Exists params; Add the .args tuple.
This commit is contained in:
parent
1efdbb33c4
commit
528302b674
1 changed files with 5 additions and 4 deletions
|
@ -25,6 +25,7 @@ class EtiquetteException(Exception, metaclass=ErrorTypeAdder):
|
||||||
self.given_args = args
|
self.given_args = args
|
||||||
self.given_kwargs = kwargs
|
self.given_kwargs = kwargs
|
||||||
self.error_message = self.error_message.format(*args, **kwargs)
|
self.error_message = self.error_message.format(*args, **kwargs)
|
||||||
|
self.args = (self.error_message, args, kwargs)
|
||||||
|
|
||||||
|
|
||||||
# NO SUCH
|
# NO SUCH
|
||||||
|
@ -58,7 +59,7 @@ class AlbumExists(EtiquetteException):
|
||||||
error_message = 'Album "{}" already exists.'
|
error_message = 'Album "{}" already exists.'
|
||||||
def __init__(self, album):
|
def __init__(self, album):
|
||||||
self.album = album
|
self.album = album
|
||||||
EtiquetteException.__init__(self, album.id)
|
EtiquetteException.__init__(self, album)
|
||||||
|
|
||||||
class GroupExists(EtiquetteException):
|
class GroupExists(EtiquetteException):
|
||||||
error_message = '{member} already in group {group}'
|
error_message = '{member} already in group {group}'
|
||||||
|
@ -67,19 +68,19 @@ class PhotoExists(EtiquetteException):
|
||||||
error_message = 'Photo "{}" already exists.'
|
error_message = 'Photo "{}" already exists.'
|
||||||
def __init__(self, photo):
|
def __init__(self, photo):
|
||||||
self.photo = photo
|
self.photo = photo
|
||||||
EtiquetteException.__init__(self, photo.id)
|
EtiquetteException.__init__(self, photo)
|
||||||
|
|
||||||
class TagExists(EtiquetteException):
|
class TagExists(EtiquetteException):
|
||||||
error_message = 'Tag "{}" already exists.'
|
error_message = 'Tag "{}" already exists.'
|
||||||
def __init__(self, tag):
|
def __init__(self, tag):
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
EtiquetteException.__init__(self, tag.name)
|
EtiquetteException.__init__(self, tag)
|
||||||
|
|
||||||
class UserExists(EtiquetteException):
|
class UserExists(EtiquetteException):
|
||||||
error_message = 'User "{}" already exists.'
|
error_message = 'User "{}" already exists.'
|
||||||
def __init__(self, user):
|
def __init__(self, user):
|
||||||
self.user = user
|
self.user = user
|
||||||
EtiquetteException.__init__(self, user.username)
|
EtiquetteException.__init__(self, user)
|
||||||
|
|
||||||
|
|
||||||
# TAG ERRORS
|
# TAG ERRORS
|
||||||
|
|
Loading…
Reference in a new issue