From e2cf9344c17509ac2de48685c613c0a75c41b9a8 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 20 Apr 2018 15:31:41 -0700 Subject: [PATCH] Copy the inputted new_photo_kwargs so as not to damage it. Also I learned that pop takes a fallback. --- etiquette/photodb.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index a738ffa..97999d0 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1093,10 +1093,9 @@ class PDBUtilMixin: return exclude_filenames def _normalize_new_photo_kwargs(new_photo_kwargs): - if 'commit' in new_photo_kwargs: - new_photo_kwargs.pop('commit') - if 'filepath' in new_photo_kwargs: - new_photo_kwargs.pop('filepath') + new_photo_kwargs = new_photo_kwargs.copy() + new_photo_kwargs.pop('commit', None) + new_photo_kwargs.pop('filepath', None) return new_photo_kwargs def _normalize_new_photo_ratelimit(new_photo_ratelimit):