From 1b15ea6b2bae0504add94f393a4a0340bc9e01c2 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sat, 18 Jan 2025 14:58:27 +0100 Subject: [PATCH] =?UTF-8?q?On=20garde=20les=20=C3=A9v=C3=A9nements=20sans?= =?UTF-8?q?=20titre=20ou=20date,=20mais=20on=20les=20non-publie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/import_tasks/extractor.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/agenda_culturel/import_tasks/extractor.py b/src/agenda_culturel/import_tasks/extractor.py index 340fccd..67c855a 100644 --- a/src/agenda_culturel/import_tasks/extractor.py +++ b/src/agenda_culturel/import_tasks/extractor.py @@ -5,7 +5,6 @@ import unicodedata from django.utils import timezone - class Extractor(ABC): url_referer=None @@ -177,12 +176,17 @@ class Extractor(ABC): image=None, image_alt=None, ): + comments = '' if title is None: - print("ERROR: cannot import an event without name") - return + print("WARNING: cannot publish an event without name") + published = False + title = _('Unknown title') if start_day is None: - print("ERROR: cannot import an event without start day") - return + print("WARNING: cannot publish an event without start day") + published = False + start_day = datetime.now().date() + comments = 'Warning: the date has not been imported correctly.' + title += ' - Warning: the date has not been imported correctly.' tags_default = self.default_value_if_exists(default_values, "tags") if not tags_default: @@ -203,6 +207,11 @@ class Extractor(ABC): "email": self.default_value_if_exists(default_values, "email"), "comments": self.default_value_if_exists(default_values, "comments"), } + if event["comments"] is None: + event["comments"] = comments + else: + event["comments"] += '\n' + comments + # TODO: pourquoi url_human et non reference_url if url_human is not None: event["url_human"] = url_human