diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-24 02:22:49 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-24 02:26:02 +0100 |
commit | b9d80c3cf4b3e7664c988b7d180dd074767f67d8 (patch) | |
tree | 43ed1afd6ca0d3d253a49247b0b92dfdfd771d14 /contrib/caldav/calcurse-caldav.py | |
parent | 84c0f8b5f8628b1c715eb7fb422528bc7ebc65d0 (diff) | |
download | calcurse-b9d80c3cf4b3e7664c988b7d180dd074767f67d8.tar.gz calcurse-b9d80c3cf4b3e7664c988b7d180dd074767f67d8.zip |
calcurse-caldav: Add XML declaration to requests
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib/caldav/calcurse-caldav.py')
-rwxr-xr-x | contrib/caldav/calcurse-caldav.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index 8afbd4b..262f4ee 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -120,16 +120,17 @@ def remote_query(cmd, path, additional_headers, body): def get_hrefmap(conn, uid=None): if uid: - propfilter = '<c:prop-filter name="UID">' +\ - '<c:text-match collation="i;octet" >%s</c:text-match>' +\ - '</c:prop-filter>' % (uid) + propfilter = '<C:prop-filter name="UID">' +\ + '<C:text-match collation="i;octet" >%s</C:text-match>' +\ + '</C:prop-filter>' % (uid) else: propfilter = '' - body = '<c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">' +\ - '<d:prop><d:getetag /></d:prop><c:filter>' +\ - '<c:comp-filter name="VCALENDAR">' + propfilter + '</c:comp-filter>' +\ - '</c:filter></c:calendar-query>' + body = '<?xml version="1.0" encoding="utf-8" ?>' +\ + '<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">' +\ + '<D:prop><D:getetag /></D:prop><C:filter>' +\ + '<C:comp-filter name="VCALENDAR">' + propfilter + '</C:comp-filter>' +\ + '</C:filter></C:calendar-query>' headers, body = remote_query("REPORT", path, {}, body) if not headers: return {} @@ -250,11 +251,12 @@ def pull_objects(conn, syncdb, hrefmap): orphan = set(syncdb.keys()) - set(hrefmap.keys()) # Download and import new objects from the server. - body = '<c:calendar-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">' +\ - '<d:prop><d:getetag /><c:calendar-data /></d:prop>' + body = '<?xml version="1.0" encoding="utf-8" ?>' +\ + '<C:calendar-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">' +\ + '<D:prop><D:getetag /><C:calendar-data /></D:prop>' for etag in missing: - body += '<d:href>%s</d:href>' % (hrefmap[etag]) - body += '</c:calendar-multiget>' + body += '<D:href>%s</D:href>' % (hrefmap[etag]) + body += '</C:calendar-multiget>' headers, body = remote_query("REPORT", path, {}, body) root = etree.fromstring(body) |