diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-08-12 14:10:23 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-08-12 14:10:23 +0300 |
| commit | 5df0b8cf8cc0ca5eb6af8428e5ba6a8c4bb38f34 (patch) | |
| tree | a6eec7b0d6a9068a69a4af48277a20ae67b592e8 /addons/document_webdav/webdav_server.py | |
| parent | 71c5192b080c2ee424c524e5a2b14d03b76be72b (diff) | |
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
Diffstat (limited to 'addons/document_webdav/webdav_server.py')
| -rw-r--r-- | addons/document_webdav/webdav_server.py | 13 |
1 files changed, 10 insertions, 3 deletions
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) |
