diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-08-12 14:10:31 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-08-12 14:10:31 +0300 |
| commit | 59c236eff1e4fb8a93d2ba2072b641a3d4331ce3 (patch) | |
| tree | ae4cfb064a94503a01130d6fc88ae98ff1b8315c | |
| parent | c2fee9e69119addd84897005f4eb3ce7ad34a732 (diff) | |
caldav: Store times at server's timezone, not utc.
The values stored from caldav should be at the server's timezone, like
all other timestamps of openerp. We accept any timezone in the iCalendar
files, we export our (server's) timezone by default.
bzr revid: p_christ@hol.gr-20100812111031-m14103hzl9q7ff9j
| -rw-r--r-- | addons/caldav/calendar.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index 38367936541..3f7661a15fd 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -233,6 +233,8 @@ class CalDAV(object): att_data = [] exdates = [] + _server_tzinfo = pytz.timezone(tools.get_server_timezone()) + for cal_data in child.getChildren(): if cal_data.name.lower() == 'organizer': self.ical_set(cal_data.name.lower(), @@ -264,9 +266,11 @@ class CalDAV(object): continue if cal_data.name.lower() in self.__attribute__: if cal_data.params.get('X-VOBJ-ORIGINAL-TZID'): - self.ical_set('vtimezone', cal_data.params.get('X-VOBJ-ORIGINAL-TZID'), 'value') - date_utc = cal_data.value.astimezone(pytz.utc) - self.ical_set(cal_data.name.lower(), date_utc, 'value') + # since we do convert, do we also need to save the original tzid? + # self.ical_set('vtimezone', cal_data.params.get('X-VOBJ-ORIGINAL-TZID'), 'value') + + date_local = cal_data.value.astimezone(_server_tzinfo) + self.ical_set(cal_data.name.lower(), date_local, 'value') continue self.ical_set(cal_data.name.lower(), cal_data.value, 'value') vals = map_data(cr, uid, self, context=context) |
