From 98a545e16640b6a6a093d58fe6a0cdaabc23fedd Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 2 Oct 2021 12:45:37 -0700 Subject: [PATCH] Move assert_not_deleted to worms. --- etiquette/exceptions.py | 6 ------ etiquette/objects.py | 10 +--------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/etiquette/exceptions.py b/etiquette/exceptions.py index 2ee6181..6b0d582 100644 --- a/etiquette/exceptions.py +++ b/etiquette/exceptions.py @@ -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. diff --git a/etiquette/objects.py b/etiquette/objects.py index 790052c..1f32fce 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -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