Facebook Organiser Fix & iCal Workaround
authorJames French <[email protected]>
Tue, 14 Jun 2011 10:51:40 +0000 (18:51 +0800)
committerJames French <[email protected]>
Mon, 4 Mar 2013 08:38:39 +0000 (16:38 +0800)
- iCal/iPhone don't like multiple EXDATES on one line, break them out into
  seperate entries
- Changed where the organiser sits for facebook events that are group organised
- Todo: specify rule lists
- Ignored some files

.gitignore
parserrules.py

index 843ff47..866dbd9 100644 (file)
@@ -1,2 +1,4 @@
 .httplib2-cache
+.pydevproject
+.project
 *.pyc
index 973aa45..cf60f98 100644 (file)
@@ -51,7 +51,9 @@ def whatPrivacy(cal):
 
        for event in cal.vevent_list:
                if event.contents.has_key(u'class'):
-                       getattr(event, 'class').value = "PUBLIC"
+                       # Bit of a hack as class is a reserved word in python
+                       del event.contents[u'class']
+                       event.add('class').value = "PUBLIC"
 
        return cal
 
@@ -160,3 +162,20 @@ def unwantedParams(cal):
 
        return cal
 
+def exDate(cal):
+       '''Changes multi-EXDATE into singles (apple can't obey even simple specs)'''
+
+       for event in cal.vevent_list:
+               if not event.contents.has_key(u'exdate'): continue
+               dates = event.exdate.value
+               try: tzid = event.exdate.tzid_param
+               except AttributeError: tzid = ''
+
+               del event.contents[u'exdate']
+
+               for date in dates:
+                       entry = event.add(u'exdate')
+                       entry.value = [date]
+                       if tzid: entry.tzid_param = tzid
+
+       return cal

UCC git Repository :: git.ucc.asn.au