[conduit/tracker] Handler for ncal.RecurrenceRule -> ical
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit/tracker] Handler for ncal.RecurrenceRule -> ical
- Date: Fri, 19 Jun 2009 19:35:11 -0400 (EDT)
commit 622fb32ce3915720a4fe7a060215c5e84eb5a691
Author: John Carr <john carr unrouted co uk>
Date: Thu Jun 18 23:59:07 2009 +0100
Handler for ncal.RecurrenceRule -> ical
conduit/modules/TrackerModule/TrackerModule.py | 28 ++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/conduit/modules/TrackerModule/TrackerModule.py b/conduit/modules/TrackerModule/TrackerModule.py
index f21538f..d71a9dd 100644
--- a/conduit/modules/TrackerModule/TrackerModule.py
+++ b/conduit/modules/TrackerModule/TrackerModule.py
@@ -314,6 +314,28 @@ class TrackerCalendar(DataProvider.TwoWay):
t.commit()
return t
+ def _create_ical_recurrence(self, t):
+ v = ""
+ for key, value in t.properties():
+ if key in ("ncal:bysecond", "ncal:byminute", "ncal:byhour", "ncal:bymonthday",
+ "ncal:bymonth", "ncal:bysetpos", "ncal:byweekno", "ncal:byyearday",
+ "ncal:count", "ncal:interval"):
+ v += "%s=%s" % (key, value)
+ elif key == "byday":
+ #v.byday
+ pass
+ elif key == "freq":
+ #v.freq
+ pass
+ elif key == "until":
+ pass
+ elif key == "wkst":
+ #v.wkst ncal:Weekday
+ pass
+ else:
+ log.debug("Unknown rrule property: %s" % key)
+ return v
+
def _ical_to_tracker(self, data):
ical = data.iCal
if ical.name == "VCALENDAR":
@@ -394,6 +416,12 @@ class TrackerCalendar(DataProvider.TwoWay):
ev.add('categories').value = value
elif key == "ncal:contact":
ev.add('contact').value = value
+ elif key == "ncal:rrule":
+ rrule = ncal.RecurrenceRule(value)
+ ev.add('rrule').value = self._create_ical_recurrence(rrule)
+ elif key == "ncal:exrule":
+ rrule = ncal.RecurrenceRule(value)
+ ev.add('exrule').value = self._create_ical_recurrence(rrule)
elif key == "ncal:status":
# An instance of ncal:EventStatus to represent TENTATIVE etc
pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]