From 3ef9f1cef14c8c86c157e92a4032968aad28b4a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 22 Sep 2009 21:06:44 +0000 Subject: [PATCH] Monotone-Parent: a6b2e3c5d395d584befdfa5576912f12276f0677 Monotone-Revision: fa7f4f3829eb5576b8845dcb4c03e5327cc7e354 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-09-22T21:06:44 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 16 ++++++++++++---- Tests/webdavlib.py | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b61b52da0..ff80de526 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,19 +2,27 @@ * Updated the documentation for the Invisible -> Flagged mail column change. - * SoObjects/Contacts/NGVCard+SOGo.m - better error-handling. + * SoObjects/Contacts/NGVCard+SOGo.m - better error-handling. 2009-09-22 Cyril Robert - * UI/Scheduler/UIxCalFolderActions.m (exportAction): Used bareFetchFields from - SOGoAppointmentFolder instead of fetchFields from SOGoGCSFolder. + * UI/Scheduler/UIxCalFolderActions.m (exportAction): Used + bareFetchFields from SOGoAppointmentFolder instead of fetchFields + from SOGoGCSFolder. 2009-09-22 Wolfgang Sourdeau + * Tests/webdavlib.py (_WD_XMLTreeElement.__init__): added a new + optional parameter "attributes" that enables the setting of + element attributes during the rendering of the element. + + * Tests/webdavlib.py (CalDAVCalendarQuery): new subclass of + WebDAVReport that handles "calendar-query" reports. + * UI/MailerUI/UIxMailListView.m (+initialize): new method initialized the two new global NSArray: defaultColumnOrder (hardcoded values), udColumnOrder (system default values). - (-columnsDisplayOrder): we now cache the resulting set of keys. + (-columnsDisplayOrder): we now cache the resulting set of keys. We also test for the presence of invalid keys by comparing the configured array with the hardcoded one above. (-setCurrentColumn:, currentColumn): new accessors. diff --git a/Tests/webdavlib.py b/Tests/webdavlib.py index 9ff5bf90c..d82703b5b 100644 --- a/Tests/webdavlib.py +++ b/Tests/webdavlib.py @@ -208,6 +208,33 @@ class CalDAVCalendarMultiget(WebDAVREPORT): self.top_node.append(href_node) href_node.append(_WD_XMLTreeTextNode(href)) +class CalDAVCalendarQuery(WebDAVREPORT): + def __init__(self, url, properties, component = None, timerange = None): + WebDAVQuery.__init__(self, url) + multiget_tag = self.ns_mgr.register("calendar-query", "urn:ietf:params:xml:ns:caldav") + self.top_node = _WD_XMLTreeElement(multiget_tag) + props = _WD_XMLTreeElement("prop") + self.top_node.append(props) + for prop in properties: + prop_tag = self.render_tag(prop) + props.append(_WD_XMLTreeElement(prop_tag)) + + if component is not None: + filter_tag = self.ns_mgr.register("filter", + "urn:ietf:params:xml:ns:caldav") + compfilter_tag = self.ns_mgr.register("comp-filter", + "urn:ietf:params:xml:ns:caldav") + filter_node = _WD_XMLTreeElement(filter_tag) + cal_filter_node = _WD_XMLTreeElement(compfilter_tag, + { "name": "VCALENDAR" }) + comp_node = _WD_XMLTreeElement(compfilter_tag, + { "name": component }) + ## TODO + # if timerange is not None: + cal_filter_node.append(comp_node) + filter_node.append(cal_filter_node) + self.top_node.append(filter_node) + class WebDAVSyncQuery(WebDAVREPORT): def __init__(self, url, token, properties): WebDAVQuery.__init__(self, url) @@ -261,9 +288,10 @@ class _WD_XMLNS_MGR: return newTag class _WD_XMLTreeElement: - def __init__(self, tag): + def __init__(self, tag, attributes = {}): self.tag = tag self.children = [] + self.attributes = attributes def append(self, child): self.children.append(child) @@ -274,6 +302,9 @@ class _WD_XMLTreeElement: if ns_text is not None: text = text + ns_text + for k in self.attributes: + text = text + " %s=\"%s\"" % (k, self.attributes[k]) + if len(self.children) > 0: text = text + ">" for child in self.children: