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:
voussoir 2017-08-01 18:13:54 -07:00
parent a026a7488e
commit 89d9c1d893

View file

@ -1226,7 +1226,13 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs
try:
photo = self.get_photo_by_path(filepath)
except exceptions.NoSuchPhoto:
makenew = True
else:
makenew = False
if makenew:
photo = self.new_photo(filepath.absolute_path, commit=False, **new_photo_kwargs)
new_photos.append(photo)
if not make_albums: