Delete some old vars and slightly improve some clarity.
This commit is contained in:
		
							parent
							
								
									47db917090
								
							
						
					
					
						commit
						4087827e86
					
				
					 2 changed files with 12 additions and 9 deletions
				
			
		|  | @ -277,10 +277,6 @@ class Album(ObjectBase, GroupableMixin): | ||||||
| 
 | 
 | ||||||
|         self.group_getter_many = self.photodb.get_albums_by_id |         self.group_getter_many = self.photodb.get_albums_by_id | ||||||
| 
 | 
 | ||||||
|         self._sum_bytes_local = None |  | ||||||
|         self._sum_bytes_recursive = None |  | ||||||
|         self._sum_photos_recursive = None |  | ||||||
| 
 |  | ||||||
|     def __repr__(self): |     def __repr__(self): | ||||||
|         return f'Album:{self.id}' |         return f'Album:{self.id}' | ||||||
| 
 | 
 | ||||||
|  | @ -374,9 +370,12 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|     def add_photos(self, photos): |     def add_photos(self, photos): | ||||||
|         existing_photos = set(self.get_photos()) |         existing_photos = set(self.get_photos()) | ||||||
|         photos = set(photos) |         photos = set(photos) | ||||||
|         photos = photos.difference(existing_photos) |         new_photos = photos.difference(existing_photos) | ||||||
| 
 | 
 | ||||||
|         for photo in photos: |         if not new_photos: | ||||||
|  |             return | ||||||
|  | 
 | ||||||
|  |         for photo in new_photos: | ||||||
|             self._add_photo(photo) |             self._add_photo(photo) | ||||||
| 
 | 
 | ||||||
|     # Photo.add_tag already has @required_feature |     # Photo.add_tag already has @required_feature | ||||||
|  | @ -457,7 +456,6 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|         return directories |         return directories | ||||||
| 
 | 
 | ||||||
|     def get_photos(self): |     def get_photos(self): | ||||||
|         photos = [] |  | ||||||
|         photo_rows = self.photodb.sql_select( |         photo_rows = self.photodb.sql_select( | ||||||
|             'SELECT photoid FROM album_photo_rel WHERE albumid == ?', |             'SELECT photoid FROM album_photo_rel WHERE albumid == ?', | ||||||
|             [self.id] |             [self.id] | ||||||
|  | @ -556,9 +554,12 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|     def remove_photos(self, photos): |     def remove_photos(self, photos): | ||||||
|         existing_photos = set(self.get_photos()) |         existing_photos = set(self.get_photos()) | ||||||
|         photos = set(photos) |         photos = set(photos) | ||||||
|         photos = photos.intersection(existing_photos) |         remove_photos = photos.intersection(existing_photos) | ||||||
| 
 | 
 | ||||||
|         for photo in photos: |         if not remove_photos: | ||||||
|  |             return | ||||||
|  | 
 | ||||||
|  |         for photo in remove_photos: | ||||||
|             self._remove_photo(photo) |             self._remove_photo(photo) | ||||||
| 
 | 
 | ||||||
|     def sum_bytes(self, recurse=True): |     def sum_bytes(self, recurse=True): | ||||||
|  |  | ||||||
|  | @ -64,6 +64,8 @@ file_etag_manager = client_caching.FileEtagManager( | ||||||
| _original_route = site.route | _original_route = site.route | ||||||
| def decorate_and_route(*route_args, **route_kwargs): | def decorate_and_route(*route_args, **route_kwargs): | ||||||
|     def wrapper(endpoint): |     def wrapper(endpoint): | ||||||
|  |         # Since a function might have multiple routes, we may be seeing the | ||||||
|  |         # same one multiple times. The _fully_decorated will track that. | ||||||
|         if not hasattr(endpoint, '_fully_decorated'): |         if not hasattr(endpoint, '_fully_decorated'): | ||||||
|             endpoint = decorators.catch_etiquette_exception(endpoint) |             endpoint = decorators.catch_etiquette_exception(endpoint) | ||||||
|             endpoint = session_manager.give_token(endpoint) |             endpoint = session_manager.give_token(endpoint) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue