Skip to content

Commit

Permalink
don't pop the dict while iterating it
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jul 18, 2016
1 parent 5c9d11e commit c53ad18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nikola/image_processing.py
Expand Up @@ -79,17 +79,17 @@ def filter_exif(self, exif, whitelist):
return {}

# Scenario 3: keep some
for k in exif:
for k in list(exif.keys()):
if type(exif[k]) != dict:
pass # At least thumbnails have no fields
if k not in whitelist:
elif k not in whitelist:
exif.pop(k) # Not whitelisted, remove
elif k in whitelist and whitelist[k] == '*':
# Fully whitelisted, keep all
pass
else:
# Partially whitelisted
for tag in exif[k]:
for tag in list(exif[k].keys()):
if EXIF_TAG_NAMES[tag] not in whitelist[k]:
exif[k].pop(tag)

Expand Down

0 comments on commit c53ad18

Please sign in to comment.