From 1c20ac93bffa114d45f78b1a48856eea216e6bed Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Fri, 3 May 2024 12:17:46 +0200 Subject: [PATCH] =?UTF-8?q?Si=20le=20fichier=20est=20vide,=20on=20ne=20l?= =?UTF-8?q?=C3=A8ve=20pas=20d'erreur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/import_tasks/extractor_ical.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/agenda_culturel/import_tasks/extractor_ical.py b/src/agenda_culturel/import_tasks/extractor_ical.py index b80c138..5d02b45 100644 --- a/src/agenda_culturel/import_tasks/extractor_ical.py +++ b/src/agenda_culturel/import_tasks/extractor_ical.py @@ -51,8 +51,6 @@ class ICALExtractor(Extractor): def extract( self, content, url, url_human=None, default_values=None, published=False ): - if content == "": - raise Exception(_('The source is empty')) warnings.filterwarnings("ignore", category=MarkupResemblesLocatorWarning) print("Extracting ical events from {}".format(url)) @@ -60,6 +58,9 @@ class ICALExtractor(Extractor): self.clear_events() self.uuids = {} + if content == "": + return self.get_structure() + calendar = icalendar.Calendar.from_ical(content) for event in calendar.walk("VEVENT"):