-def dropMSKeys(cal):
- '''Drops microsoft keys, good for outlook, just bandwidth when not.'''
-
- eventBlacklist = [x.lower() for x in [
- "X-ALT-DESC",
- "X-MICROSOFT-CDO-BUSYSTATUS",
- "X-MICROSOFT-CDO-IMPORTANCE",
- "X-MICROSOFT-DISALLOW-COUNTER",
- "X-MS-OLK-ALLOWEXTERNCHECK",
- "X-MS-OLK-AUTOSTARTCHECK",
- "X-MS-OLK-CONFTYPE",
- "X-MS-OLK-AUTOFILLLOCATION"
- ]]
-
- vcalBlacklist = [x.lower() for x in [
- "X-CALEND",
- "X-CALSTART",
- "X-CLIPEND",
- "X-CLIPSTART",
- "X-MS-OLK-WKHRDAYS",
- "X-MS-OLK-WKHREND",
- "X-MS-OLK-WKHRSTART",
- "X-OWNER",
- "X-PRIMARY-CALENDAR",
- "X-PUBLISHED-TTL",
- "X-WR-CALDESC",
- "X-WR-CALNAME",
- "X-WR-RELCALID"
- ]]
+def exDate(cal):
+ '''Replacing multi-value EXDATES with multiple single-value EXDATES'''
+
+ from datetime import datetime
+ from pytz import timezone
+
+ default = timezone(ruleConfig["defaultTZ"])
+
+ for event in cal.vevent_list:
+ if not event.contents.has_key(u'exdate'): continue
+ dates = event.exdate.value
+
+ del event.contents[u'exdate']
+
+ for date in dates:
+ if isinstance(date, datetime):
+ if date.tzinfo is None: date = date.replace(tzinfo = default)
+ date = date.astimezone(vobject.icalendar.utc)
+ entry = event.add(u'exdate')
+ entry.value = [date]
+
+ return cal
+
+def utcise(cal):
+ '''Removing local timezones in favour of UTC. If the remote calendar specifies a timezone
+ then use it, otherwise assume it's in the user-specified or default values'''
+
+ from datetime import datetime
+ from pytz import timezone
+
+ default = timezone(ruleConfig["defaultTZ"])