From b0d060822c19b1914a13a645dfcb765558857480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Antoine=20Marcus=20Dupr=C3=A9?= Date: Fri, 20 Oct 2023 10:37:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20[BUGFIX]=20Fix=20`sync=5Frando`?= =?UTF-8?q?=20failure=20with=20SVG=20attachment=20(#3803)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 5 +++++ geotrek/common/mixins/models.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c7f0eebb10..6e123911d5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,11 @@ CHANGELOG 2.101.2+dev (XXXX-XX-XX) ------------------------ +**Bug fixes** + +- Fix `sync_rando` admin command failure if Trek has SVG attachment (#3803) + + 2.101.2 (2023-10-17) ------------------------ diff --git a/geotrek/common/mixins/models.py b/geotrek/common/mixins/models.py index 6dbb388bbe..813cc46361 100644 --- a/geotrek/common/mixins/models.py +++ b/geotrek/common/mixins/models.py @@ -16,6 +16,7 @@ from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from easy_thumbnails.alias import aliases +from easy_thumbnails.engine import NoSourceGenerator from easy_thumbnails.exceptions import InvalidImageFormatError from easy_thumbnails.files import get_thumbnailer from embed_video.backends import detect_backend, VideoDoesntExistException @@ -153,7 +154,7 @@ def resized_pictures(self): }) thdetail = thumbnailer.get_thumbnail(ali) - except (IOError, InvalidImageFormatError, DecompressionBombError) as e: + except (IOError, InvalidImageFormatError, DecompressionBombError, NoSourceGenerator) as e: logger.info(_("Image {} invalid or missing from disk: {}.").format(picture.attachment_file, e)) else: resized.append((picture, thdetail)) @@ -445,7 +446,7 @@ def get_uuid_duplication(uid_field): class GeotrekMapEntityMixin(MapEntityMixin): elements_duplication = { "attachments": {"uuid": get_uuid_duplication}, - "avoid_fields": ["aggregations", "children",], + "avoid_fields": ["aggregations", "children"], "uuid": get_uuid_duplication, }