From 9803b5007dc39643278522e27dad848766271078 Mon Sep 17 00:00:00 2001 From: dlichtistw Date: Sun, 16 Sep 2018 22:37:23 +0200 Subject: [PATCH] Strip exception dates Don't fail for single exception dates. --- icalevents/icalparser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/icalevents/icalparser.py b/icalevents/icalparser.py index 5dfa155..540fb59 100644 --- a/icalevents/icalparser.py +++ b/icalevents/icalparser.py @@ -6,6 +6,7 @@ from random import randint from datetime import datetime, timedelta, date from icalendar import Calendar +from icalendar.prop import vDDDLists from pytz import utc @@ -340,8 +341,11 @@ def extract_exdates(component): exd_prop = component.get('exdate') if exd_prop: - for exd_list in exd_prop: - dates.extend(exd.dt for exd in exd_list.dts if (exd)) + if isinstance(exd_prop, list): + for exd_list in exd_prop: + dates.extend(exd.dt for exd in exd_list.dts) + elif isinstance(exd_prop, vDDDLists): + dates.extend(exd.dt for exd in exd_prop.dts) return dates