From 6ad4fbfc80f644b3f6dffa15560076d26074a777 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 10 Aug 2010 15:29:57 +0300 Subject: [PATCH] CalDAV: Fix support for WebCal CalDAV+GroupDAV is a collection of .ics files (resources). WebCal is a single .ics resource with all calendar data in it. So, support both of those nodes for every calendar instance, eg: /dbname/Calendars/Meetings : collection /dbname/Calendars/Meetings.ics : vcalendar file bzr revid: p_christ@hol.gr-20100810122957-a1691wv8ultbki55 --- addons/caldav/caldav_node.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/caldav/caldav_node.py b/addons/caldav/caldav_node.py index b931b0f0328..5ebe38cc308 100644 --- a/addons/caldav/caldav_node.py +++ b/addons/caldav/caldav_node.py @@ -71,8 +71,8 @@ class node_calendar_collection(nodes.node_dir): where = [('collection_id','=',self.dir_id)] ext = False if name and name.endswith('.ics'): - name = name[-4] - ext = '.ics' + name = name[:-4] + ext = True if name: where.append(('name','=',name)) if not domain: @@ -81,11 +81,12 @@ class node_calendar_collection(nodes.node_dir): fil_obj = dirobj.pool.get('basic.calendar') ids = fil_obj.search(cr,uid,where,context=ctx) res = [] - for calender in fil_obj.browse(cr, uid, ids, context=ctx): - if not ext: - res.append(node_calendar(calender.name, self, self.context, calender)) - else: - res.append(res_node_calendar(name, self, self.context, calender)) + for cal in fil_obj.browse(cr, uid, ids, context=ctx): + if (not name) or not ext: + res.append(node_calendar(cal.name, self, self.context, cal)) + if (not name) or ext: + res.append(res_node_calendar(cal.name+'.ics', self, self.context, cal)) + # May be both of them! return res def _get_dav_owner(self, cr):