On gère mieux les urls sans événement
This commit is contained in:
parent
9bb3373f99
commit
1c812a3d65
@ -243,14 +243,17 @@ def import_events_from_url(self, url, cat):
|
|||||||
url, published=False, default_values=values
|
url, published=False, default_values=values
|
||||||
)
|
)
|
||||||
|
|
||||||
# convert it to json
|
if events:
|
||||||
json_events = json.dumps(events, default=str)
|
# convert it to json
|
||||||
|
json_events = json.dumps(events, default=str)
|
||||||
|
|
||||||
# import events (from json)
|
# import events (from json)
|
||||||
success, error_message = importer.import_events(json_events)
|
success, error_message = importer.import_events(json_events)
|
||||||
|
|
||||||
# finally, close task
|
# finally, close task
|
||||||
close_import_task(self.request.id, success, error_message, importer)
|
close_import_task(self.request.id, success, error_message, importer)
|
||||||
|
else:
|
||||||
|
close_import_task(self.request.id, False, "Cannot find any event", importer)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
close_import_task(self.request.id, False, e, importer)
|
close_import_task(self.request.id, False, e, importer)
|
||||||
|
@ -264,6 +264,8 @@ class FacebookEventExtractor(Extractor):
|
|||||||
event["category"] = default_values["category"]
|
event["category"] = default_values["category"]
|
||||||
self.add_event(**event)
|
self.add_event(**event)
|
||||||
return self.get_structure()
|
return self.get_structure()
|
||||||
|
else:
|
||||||
|
logger.warning("cannot find any event in page")
|
||||||
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -66,5 +66,4 @@ class GoogleCalendarLinkEventExtractor(Extractor):
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
logger.warning("ça marche")
|
|
||||||
return self.get_structure()
|
return self.get_structure()
|
Loading…
Reference in New Issue
Block a user