Created
May 18, 2011 14:50
-
-
Save ThiefMaster/978722 to your computer and use it in GitHub Desktop.
monkey patch to make vRecur generate an apple iCal comaptible rrule string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class vRecur(icalendar.vRecur): | |
"""Fix vRecur so the frequency comes first""" | |
def ical(self): | |
# SequenceTypes | |
result = ['FREQ=%s' % self.types['FREQ'](self['FREQ']).ical()] | |
for key, vals in self.items(): | |
if key == 'FREQ': | |
continue | |
typ = self.types[key] | |
if not type(vals) in icalendar.prop.SequenceTypes: | |
vals = [vals] | |
vals = ','.join([typ(val).ical() for val in vals]) | |
result.append('%s=%s' % (key, vals)) | |
return ';'.join(result) | |
icalendar.cal.types_factory['recur'] = vRecur |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment