diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-07-29 16:39:37 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-07-29 16:39:37 +0300 |
| commit | e78571ac67acb78882a2fc494fa5c11a6e6c911e (patch) | |
| tree | 813538b09c77c316e1d5af3f25bb99f23cb2e0a1 /addons/document_webdav/webdav.py | |
| parent | 449da75e4e98c806fa267ff7f17adaf31d5b75ca (diff) | |
Document, DAV: fix propfind/propname code
Several small fixes for the DAV responses, so that we are more conforming
to the protocol. Also fix multiple namespaces, getctag and (as always)
whitespace
bzr revid: p_christ@hol.gr-20100729133937-z6ctpn92w6mz7r9k
Diffstat (limited to 'addons/document_webdav/webdav.py')
| -rw-r--r-- | addons/document_webdav/webdav.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/addons/document_webdav/webdav.py b/addons/document_webdav/webdav.py index f2f57c77730..d7480e02cf1 100644 --- a/addons/document_webdav/webdav.py +++ b/addons/document_webdav/webdav.py @@ -65,17 +65,20 @@ def mk_prop_response(self, uri, good_props, bad_props, doc): gp=doc.createElement("D:prop") for ns in good_props.keys(): ns_prefix="ns"+str(self.namespaces.index(ns))+":" - for p,v in good_props[ns].items(): + for p,v in good_props[ns].items(): if not v: - pass + continue pe=doc.createElement(ns_prefix+str(p)) if hasattr(v, '__class__') and v.__class__.__name__ == 'Element': pe.appendChild(v) else: - if p=="resourcetype": - if v==1: + if ns == 'DAV:' and p=="resourcetype": + if v == 1: ve=doc.createElement("D:collection") pe.appendChild(ve) + elif isinstance(v,tuple) and v[1] == ns: + ve=doc.createElement(ns_prefix+v[0]) + pe.appendChild(ve) else: ve=doc.createTextNode(tools.ustr(v)) pe.appendChild(ve) @@ -147,12 +150,13 @@ def mk_propname_response(self,uri,propnames,doc): pr.setAttribute("xmlns:"+nsp,ns) nsnum=nsnum+1 - # write propertynames - for p in plist: - pe=doc.createElement(nsp+":"+p) - pr.appendChild(pe) + # write propertynames + for p in plist: + pe=doc.createElement(nsp+":"+p) + pr.appendChild(pe) + + ps.appendChild(pr) - ps.appendChild(pr) re.appendChild(ps) return re |
