Si le fichier est vide, on ne lève pas d'erreur

This commit is contained in:
Jean-Marie Favreau 2024-05-03 12:17:46 +02:00
parent 00eb45c687
commit 1c20ac93bf

View File

@ -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"):