Improved robustness of ICal event parser
This commit is contained in:
parent
518d9f20c6
commit
f9f9c38a8b
1 changed files with 8 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue