Since @transaction rolls back exceptions, don't use exception-based inserts.

This commit is contained in:
voussoir 2017-05-01 21:26:07 -07:00
parent a9c7ad6993
commit fbf73ac515

View file

@ -1254,9 +1254,9 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs
new_photos = [] new_photos = []
for filepath in files: for filepath in files:
try: try:
photo = self.get_photo_by_path(filepath)
except exceptions.NoSuchPhoto:
photo = self.new_photo(filepath.absolute_path, commit=False) photo = self.new_photo(filepath.absolute_path, commit=False)
except exceptions.PhotoExists as e:
photo = e.photo
new_photos.append(photo) new_photos.append(photo)
if not make_albums: if not make_albums: