On garde les événements sans titre ou date, mais on les non-publie

This commit is contained in:
Jean-Marie Favreau 2025-01-18 14:58:27 +01:00
parent 280f04d22f
commit 1b15ea6b2b

View File

@ -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