Move assert_not_deleted to worms.

This commit is contained in:
voussoir 2021-10-02 12:45:37 -07:00
parent 91cf08efde
commit 98a545e166
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 1 additions and 15 deletions

View file

@ -181,12 +181,6 @@ class DatabaseOutOfDate(EtiquetteException):
'''
error_message = OUTOFDATE
class DeletedObject(EtiquetteException):
'''
For when thing.deleted == True.
'''
error_message = '{} has already been deleted by another caller.'
class FeatureDisabled(EtiquetteException):
'''
For when features of the system have been disabled by the configuration.

View file

@ -38,7 +38,6 @@ class ObjectBase(worms.Object):
self.photodb = photodb
# Used by decorators.required_feature.
self._photodb = photodb
self.deleted = False
@staticmethod
def normalize_author_id(author_id) -> typing.Optional[str]:
@ -62,13 +61,6 @@ class ObjectBase(worms.Object):
return author_id
def assert_not_deleted(self) -> None:
'''
Raises exceptions.DeletedObject if this object is deleted.
'''
if self.deleted:
raise exceptions.DeletedObject(self)
# Will add -> User when forward references are supported by Python.
def get_author(self):
'''
@ -585,7 +577,7 @@ class Album(ObjectBase, GroupableMixin):
'''
Raises TypeError if photo is not a Photo.
Raises exceptions.DeletedObject if self.deleted.
Raises worms.DeletedObject if self.deleted.
'''
if photo is None:
photo_id = None