From 077064b7d946ee612449540b80792e8abd4b85e5 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Fri, 1 Apr 2016 14:41:56 +0200 Subject: [PATCH] Skip not found attachments --- pillar/application/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pillar/application/__init__.py b/pillar/application/__init__.py index bc455546..c6778a71 100644 --- a/pillar/application/__init__.py +++ b/pillar/application/__init__.py @@ -262,12 +262,13 @@ def item_parse_attachments(response): # This is for the "normal" first level property else: field_content = response[field_name_path[0]] - for f in attachment['files']: - slug = f['slug'] + for af in attachment['files']: + slug = af['slug'] slug_tag = "[{0}]".format(slug) - f = files_collection.find_one({'_id': ObjectId(f['file'])}) + f = files_collection.find_one({'_id': ObjectId(af['file'])}) if f is None: - abort(404) + af['file'] = None + continue size = f['size'] if 'size' in f else 'l' # Get the correct variation from the file thumbnail = next((item for item in f['variations'] if