Move assert_not_deleted to worms.
This commit is contained in:
		
							parent
							
								
									91cf08efde
								
							
						
					
					
						commit
						98a545e166
					
				
					 2 changed files with 1 additions and 15 deletions
				
			
		|  | @ -181,12 +181,6 @@ class DatabaseOutOfDate(EtiquetteException): | ||||||
|     ''' |     ''' | ||||||
|     error_message = OUTOFDATE |     error_message = OUTOFDATE | ||||||
| 
 | 
 | ||||||
| class DeletedObject(EtiquetteException): |  | ||||||
|     ''' |  | ||||||
|     For when thing.deleted == True. |  | ||||||
|     ''' |  | ||||||
|     error_message = '{} has already been deleted by another caller.' |  | ||||||
| 
 |  | ||||||
| class FeatureDisabled(EtiquetteException): | class FeatureDisabled(EtiquetteException): | ||||||
|     ''' |     ''' | ||||||
|     For when features of the system have been disabled by the configuration. |     For when features of the system have been disabled by the configuration. | ||||||
|  |  | ||||||
|  | @ -38,7 +38,6 @@ class ObjectBase(worms.Object): | ||||||
|         self.photodb = photodb |         self.photodb = photodb | ||||||
|         # Used by decorators.required_feature. |         # Used by decorators.required_feature. | ||||||
|         self._photodb = photodb |         self._photodb = photodb | ||||||
|         self.deleted = False |  | ||||||
| 
 | 
 | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def normalize_author_id(author_id) -> typing.Optional[str]: |     def normalize_author_id(author_id) -> typing.Optional[str]: | ||||||
|  | @ -62,13 +61,6 @@ class ObjectBase(worms.Object): | ||||||
| 
 | 
 | ||||||
|         return author_id |         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. |     # Will add -> User when forward references are supported by Python. | ||||||
|     def get_author(self): |     def get_author(self): | ||||||
|         ''' |         ''' | ||||||
|  | @ -585,7 +577,7 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|         ''' |         ''' | ||||||
|         Raises TypeError if photo is not a Photo. |         Raises TypeError if photo is not a Photo. | ||||||
| 
 | 
 | ||||||
|         Raises exceptions.DeletedObject if self.deleted. |         Raises worms.DeletedObject if self.deleted. | ||||||
|         ''' |         ''' | ||||||
|         if photo is None: |         if photo is None: | ||||||
|             photo_id = None |             photo_id = None | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue