From fbf73ac515feff3bb69bae1a0c2987a41845c2b1 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 1 May 2017 21:26:07 -0700 Subject: [PATCH] Since @transaction rolls back exceptions, don't use exception-based inserts. --- etiquette/photodb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 8f825e8..a2f8f5d 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1254,9 +1254,9 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs new_photos = [] for filepath in files: try: + photo = self.get_photo_by_path(filepath) + except exceptions.NoSuchPhoto: photo = self.new_photo(filepath.absolute_path, commit=False) - except exceptions.PhotoExists as e: - photo = e.photo new_photos.append(photo) if not make_albums: