Verified Commit f9f9c38a authored by Fabio Manganiello's avatar Fabio Manganiello
Browse files

Improved robustness of ICal event parser

parent 518d9f20
Pipeline #110 passed with stages
in 6 minutes and 34 seconds
......@@ -79,14 +79,16 @@ class CalendarIcalPlugin(Plugin, CalendarInterface):
event = self._translate_event(event)
if event['status'] and event['responseStatus'] \
and dateutil.parser.parse(event['end']['dateTime']) >= \
datetime.datetime.now(pytz.timezone('UTC')) \
if (
event['status'] != 'cancelled'
and event['end']['dateTime']
and dateutil.parser.parse(event['end']['dateTime']).replace(tzinfo=pytz.timezone('UTC')) >=
datetime.datetime.now(pytz.timezone('UTC'))
and (
(only_participating
and event['status'] == 'confirmed'
and event['responseStatus'] in ['accepted', 'tentative'])
or not only_participating):
and event.get('responseStatus') in [None, 'accepted', 'tentative'])
or not only_participating)
):
events.append(event)
return events
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment