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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user