Package: python-davlib
Version: 1.8-4
The setprops and delprops functions are BROKEN, and do not conform to the
WebDAV protocol.
Specifically, they will only work when setting, or deleting /one/ property
at a time. Though the code was clearly written to handle /multiple/
properties.
When handling multiple properties the request will /not/ be a legal WebDAV
request, and will not work.
The PROPPATCH request specification is here:
http://www.webdav.org/specs/rfc2518.html#METHOD_PROPPATCH
The specification of how a <propertyupdate/> element of such a request
should be is here:
http://www.webdav.org/specs/rfc2518.html#ELEMENT_propertyupdate
The bug is that each <!ELEMENT remove> or <!ELEMENT set> should contain
only ONE property element, and not multiple as the current python-davlib
sends.
EXAMPLE: A multiple properties PROPPATCH request should look like this:
(I'm using <DAV:remove/> but it would be almost the same for <DAV:set/>)
<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
<D:remove><D:prop><prop0 xmlns=""></prop0></D:prop></D:remove>
<D:remove><D:prop><prop1 xmlns=""></prop1></D:prop></D:remove>
<D:remove><D:prop><prop2 xmlns=""></prop2></D:prop></D:remove>
</D:propertyupdate>
==================
What the current python-davlib is producing is this:
<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
<D:remove><D:prop>
<prop0 xmlns=""></prop0>
<prop1 xmlns=""></prop1>
</D:prop></D:remove>
</D:propertyupdate>
Please apply the attached patch.
Cheers,
--
Francisco Borges
--- /usr/lib/python2.5/site-packages/davlib.py 2006-07-04 23:21:02.000000000 +0200
+++ davlib.py 2007-06-13 12:08:46.000000000 +0200
@@ -283,11 +283,10 @@
else:
xmlns = ns = ''
assert not kw, 'unknown arguments'
+ xmlprops = [ '<DAV:remove><DAV:prop>%s</DAV:prop></DAV:remove>' % i for i in names ]
body = XML_DOC_HEADER + \
- '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + \
- '><DAV:remove><DAV:prop><' + ns + \
- string.joinfields(names, '/><' + ns) + \
- '/></DAV:prop></DAV:remove></DAV:propertyupdate>'
+ '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + '>' + \
+ ''.join(xmlprops) + '</DAV:propertyupdate>'
return self.proppatch(url, body)
def setprops(self, url, *xmlprops, **props):
@@ -304,12 +303,10 @@
xmlprops.append('<%s%s>%s</%s%s>' % (ns, key, value, ns, key))
else:
xmlprops.append('<%s%s/>' % (ns, key))
- elems = string.joinfields(xmlprops, '')
+ xmlprops = [ '<DAV:set><DAV:prop>%s</DAV:prop></DAV:set>' % i for i in xmlprops ]
body = XML_DOC_HEADER + \
- '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + \
- '><DAV:set><DAV:prop>' + \
- elems + \
- '</DAV:prop></DAV:set></DAV:propertyupdate>'
+ '<DAV:propertyupdate xmlns:DAV="DAV:"' + xmlns + '>' + \
+ ''.join(xmlprops) + '</DAV:propertyupdate>'
return self.proppatch(url, body)
def get_lock(self, url, owner='', timeout=None, depth=None):