summaryrefslogtreecommitdiffstats
path: root/pykolab/xml
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-02 10:36:13 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-02 10:36:13 -0500
commit14c14b74411d6a32d5948cdbdc09eaf1ce8b7c5a (patch)
tree68044823b984fe2bb6062efc456dcdc54f0931d1 /pykolab/xml
parent3cc3391170e54fb3e4bf477562bc2ef4bf8885c3 (diff)
downloadpykolab-14c14b74411d6a32d5948cdbdc09eaf1ce8b7c5a.tar.gz
Make sure stored recurrence-id properties are returned as the correct date/datetime type (#4752)
Diffstat (limited to 'pykolab/xml')
-rw-r--r--pykolab/xml/event.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index 7a81ab8..ab643a5 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -700,7 +700,15 @@ class Event(object):
def get_recurrence_id(self):
self.thisandfuture = self.event.thisAndFuture();
- return xmlutils.from_cdatetime(self.event.recurrenceID(), True)
+ recurrence_id = xmlutils.from_cdatetime(self.event.recurrenceID(), True)
+
+ # fix recurrence-id type if stored as date instead of datetime
+ if recurrence_id is not None and isinstance(recurrence_id, datetime.date):
+ dtstart = self.get_start()
+ if not type(recurrence_id) == type(dtstart):
+ recurrence_id = datetime.datetime.combine(recurrence_id, dtstart.time()).replace(tzinfo=dtstart.tzinfo)
+
+ return recurrence_id
def get_thisandfuture(self):
self.thisandfuture = self.event.thisAndFuture();