calcurse-caldav: Add XML declaration to requests
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
84c0f8b5f8
commit
b9d80c3cf4
@ -120,16 +120,17 @@ def remote_query(cmd, path, additional_headers, body):
|
|||||||
|
|
||||||
def get_hrefmap(conn, uid=None):
|
def get_hrefmap(conn, uid=None):
|
||||||
if uid:
|
if uid:
|
||||||
propfilter = '<c:prop-filter name="UID">' +\
|
propfilter = '<C:prop-filter name="UID">' +\
|
||||||
'<c:text-match collation="i;octet" >%s</c:text-match>' +\
|
'<C:text-match collation="i;octet" >%s</C:text-match>' +\
|
||||||
'</c:prop-filter>' % (uid)
|
'</C:prop-filter>' % (uid)
|
||||||
else:
|
else:
|
||||||
propfilter = ''
|
propfilter = ''
|
||||||
|
|
||||||
body = '<c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">' +\
|
body = '<?xml version="1.0" encoding="utf-8" ?>' +\
|
||||||
'<d:prop><d:getetag /></d:prop><c:filter>' +\
|
'<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">' +\
|
||||||
'<c:comp-filter name="VCALENDAR">' + propfilter + '</c:comp-filter>' +\
|
'<D:prop><D:getetag /></D:prop><C:filter>' +\
|
||||||
'</c:filter></c:calendar-query>'
|
'<C:comp-filter name="VCALENDAR">' + propfilter + '</C:comp-filter>' +\
|
||||||
|
'</C:filter></C:calendar-query>'
|
||||||
headers, body = remote_query("REPORT", path, {}, body)
|
headers, body = remote_query("REPORT", path, {}, body)
|
||||||
if not headers:
|
if not headers:
|
||||||
return {}
|
return {}
|
||||||
@ -250,11 +251,12 @@ def pull_objects(conn, syncdb, hrefmap):
|
|||||||
orphan = set(syncdb.keys()) - set(hrefmap.keys())
|
orphan = set(syncdb.keys()) - set(hrefmap.keys())
|
||||||
|
|
||||||
# Download and import new objects from the server.
|
# Download and import new objects from the server.
|
||||||
body = '<c:calendar-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">' +\
|
body = '<?xml version="1.0" encoding="utf-8" ?>' +\
|
||||||
'<d:prop><d:getetag /><c:calendar-data /></d:prop>'
|
'<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:
|
for etag in missing:
|
||||||
body += '<d:href>%s</d:href>' % (hrefmap[etag])
|
body += '<D:href>%s</D:href>' % (hrefmap[etag])
|
||||||
body += '</c:calendar-multiget>'
|
body += '</C:calendar-multiget>'
|
||||||
headers, body = remote_query("REPORT", path, {}, body)
|
headers, body = remote_query("REPORT", path, {}, body)
|
||||||
|
|
||||||
root = etree.fromstring(body)
|
root = etree.fromstring(body)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user