From f06b0915ab5d86a871b084fc9cbb86c2d42ff076 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 15 Jul 2018 13:52:08 -0700 Subject: [PATCH] Add new_photo_kwargs to the create_or_get call. Due to the closure, it was already working just fine, but I want the explicitness of having it there. --- etiquette/photodb.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 11131da..48f50c3 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1083,9 +1083,13 @@ class PDBUtilMixin: new_photo_ratelimit = ratelimiter.Ratelimiter(allowance=1, period=new_photo_ratelimit) return new_photo_ratelimit - def create_or_fetch_photos(files): + def create_or_fetch_photos(filepaths, new_photo_kwargs): + ''' + Given an iterable of filepaths, find the corresponding Photo object + if it exists, otherwise create it and then return it. + ''' photos = [] - for filepath in files: + for filepath in filepaths: try: photo = self.get_photo_by_path(filepath) except exceptions.NoSuchPhoto: @@ -1137,7 +1141,7 @@ class PDBUtilMixin: ) for (current_directory, subdirectories, files) in walk_generator: - photos = create_or_fetch_photos(files) + photos = create_or_fetch_photos(files, new_photo_kwargs=new_photo_kwargs) if not make_albums: continue