Added Error handling for recurring events
With the added Error handling, the stability of the recurring-events-parsing section has improved as well. This is handy when using non-supported iCalendars.
This commit is contained in:
parent
cd6878f8cf
commit
7651feb7df
@ -46,6 +46,7 @@ def fetch_events():
|
||||
else:
|
||||
events.begin = events.begin.to(timezone)
|
||||
events.end = events.end.to(timezone)
|
||||
try:
|
||||
rule = re.search('RRULE:(.+?)\n', event_str).group(0)[:-2]
|
||||
if re.search('UNTIL=(.+?);', rule) and not re.search('UNTIL=(.+?)Z;', rule):
|
||||
rule = re.sub('UNTIL=(.+?);', 'UNTIL='+re.search('UNTIL=(.+?);', rule).group(0)[6:-1]+'T000000Z;', rule)
|
||||
@ -60,6 +61,9 @@ def fetch_events():
|
||||
upcoming_events.append(cc)
|
||||
#print("Added '{}' with new start at {}".format(cc.name, cc.begin.format('DD MMM YY')))
|
||||
|
||||
except Exception as e:
|
||||
print('Something went wrong while parsing recurring events')
|
||||
pass
|
||||
|
||||
"""Sort events according to their beginning date"""
|
||||
def sort_dates(event):
|
||||
|
Loading…
Reference in New Issue
Block a user