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