summaryrefslogtreecommitdiff
path: root/addons/document_webdav/webdav.py
diff options
context:
space:
mode:
authorrha@tinyerp.com <>2010-12-28 13:48:10 +0530
committerrha@tinyerp.com <>2010-12-28 13:48:10 +0530
commit8d744f2e9e657dbdb4ea90f207b7328edb6b6b90 (patch)
treea570856f09161e95ac995e6a18fbb03cff723a2a /addons/document_webdav/webdav.py
parentf8b87f9a66ea95dea68ded6209ef57c33f18702a (diff)
parent6d84b87556364fbc31973fd7e2a9832f40568cbe (diff)
[Merge]: Merge with addons2
bzr revid: rha@tinyerp.com-20101228081810-8pvhyohep36quda2
Diffstat (limited to 'addons/document_webdav/webdav.py')
-rw-r--r--addons/document_webdav/webdav.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/addons/document_webdav/webdav.py b/addons/document_webdav/webdav.py
index 302d8c2a8a7..dd19aeef7d5 100644
--- a/addons/document_webdav/webdav.py
+++ b/addons/document_webdav/webdav.py
@@ -268,6 +268,39 @@ def mk_propname_response(self,uri,propnames,doc):
PROPFIND.mk_prop_response = mk_prop_response
PROPFIND.mk_propname_response = mk_propname_response
+def mk_lock_response(self, uri, props):
+ """ Prepare the data response to a DAV LOCK command
+
+ This function is here, merely to be in the same file as the
+ ones above, that have similar code.
+ """
+ doc = domimpl.createDocument('DAV:', "D:prop", None)
+ ms = doc.documentElement
+ ms.setAttribute("xmlns:D", "DAV:")
+ # ms.tagName = 'D:multistatus'
+ namespaces = []
+ nsnum = 0
+ propgen = Prop2xml(doc, namespaces, nsnum)
+ # write href information
+ uparts=urlparse.urlparse(uri)
+ fileloc=uparts[2]
+ if isinstance(fileloc, unicode):
+ fileloc = fileloc.encode('utf-8')
+ davpath = self.parent.get_davpath()
+ if uparts[0] and uparts[1]:
+ hurl = '%s://%s%s%s' % (uparts[0], uparts[1], davpath, urllib.quote(fileloc))
+ else:
+ # When the request has been relative, we don't have enough data to
+ # reply with absolute url here.
+ hurl = '%s%s' % (davpath, urllib.quote(fileloc))
+
+ props.append( ('lockroot', 'DAV:', ('href', 'DAV:', (hurl))))
+ pld = doc.createElement('D:lockdiscovery')
+ ms.appendChild(pld)
+ propgen._prop_child(pld, 'DAV:', 'activelock', props)
+
+ return doc.toxml(encoding="utf-8")
+
super_create_prop = REPORT.create_prop
def create_prop(self):