Move the new photo creation out of the exception handler.
I don't like the "during the handling of the above exception" because it's misleading as to the source of the problem.
This commit is contained in:
		
							parent
							
								
									a026a7488e
								
							
						
					
					
						commit
						89d9c1d893
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		|  | @ -1226,7 +1226,13 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs | ||||||
|                 try: |                 try: | ||||||
|                     photo = self.get_photo_by_path(filepath) |                     photo = self.get_photo_by_path(filepath) | ||||||
|                 except exceptions.NoSuchPhoto: |                 except exceptions.NoSuchPhoto: | ||||||
|  |                     makenew = True | ||||||
|  |                 else: | ||||||
|  |                     makenew = False | ||||||
|  | 
 | ||||||
|  |                 if makenew: | ||||||
|                     photo = self.new_photo(filepath.absolute_path, commit=False, **new_photo_kwargs) |                     photo = self.new_photo(filepath.absolute_path, commit=False, **new_photo_kwargs) | ||||||
|  | 
 | ||||||
|                 new_photos.append(photo) |                 new_photos.append(photo) | ||||||
| 
 | 
 | ||||||
|             if not make_albums: |             if not make_albums: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue