From 5df0b8cf8cc0ca5eb6af8428e5ba6a8c4bb38f34 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Thu, 12 Aug 2010 14:10:23 +0300 Subject: Doc Webdav: at PUT, return feedback about created node. Used in caldav, the final location of the node and its ETag must be returned after creation. bzr revid: p_christ@hol.gr-20100812111023-s6dv0g24enfghki9 --- addons/document_webdav/webdav_server.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'addons/document_webdav/webdav_server.py') diff --git a/addons/document_webdav/webdav_server.py b/addons/document_webdav/webdav_server.py index 34c255a2b3e..3cda2ccc6fe 100644 --- a/addons/document_webdav/webdav_server.py +++ b/addons/document_webdav/webdav_server.py @@ -214,13 +214,20 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): return self.send_status(ec) headers = {} + etag = None + if location and isinstance(location, tuple): + etag = location[1] + location = location[0] + # note that we have allowed for > 2 elems if location: headers['Location'] = location try: - etag = dc.get_prop(location or uri, "DAV:", "getetag") - headers['ETag'] = etag - except: + if not etag: + etag = dc.get_prop(location or uri, "DAV:", "getetag") + if etag: + headers['ETag'] = str(etag) + except Exception: pass self.send_body(None, '201', 'Created', '', headers=headers) -- cgit v1.2.3