summaryrefslogtreecommitdiff
path: root/addons/document_webdav/dav_fs.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-07-29 16:39:36 +0300
committerP. Christeas <p_christ@hol.gr>2010-07-29 16:39:36 +0300
commit4ab6bf860cb4b9e96eb3bb1006d6548e24ea643f (patch)
tree78bd60cdfba221d2db26d689985ae3690a921327 /addons/document_webdav/dav_fs.py
parentfe0ee384c7b5a64c12f8725027352df173701456 (diff)
Doc webdav: use the new server API for http OPTIONS
Since a063f7e441f910f, server has a better API for the http options, use that instead of the ill-written do_OPTIONS handler.' bzr revid: p_christ@hol.gr-20100729133936-e0laz7p3j1l2zodo
Diffstat (limited to 'addons/document_webdav/dav_fs.py')
-rw-r--r--addons/document_webdav/dav_fs.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/document_webdav/dav_fs.py b/addons/document_webdav/dav_fs.py
index ab9d3a75ae4..9b36a7d78dd 100644
--- a/addons/document_webdav/dav_fs.py
+++ b/addons/document_webdav/dav_fs.py
@@ -134,6 +134,32 @@ class openerp_dav_handler(dav_interface):
cr.close()
return res
+ def prep_http_options(self, uri, opts):
+ """see HttpOptions._prep_OPTIONS """
+ self.parent.log_message('get options: %s' % uri)
+ cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True)
+
+ if not dbname:
+ if cr: cr.close()
+ return opts
+ node = self.uri2object(cr, uid, pool, uri2[:])
+
+ if not node:
+ if cr: cr.close()
+ return opts
+ else:
+ if hasattr(node, 'http_options'):
+ ret = opts.copy()
+ for key, val in node.http_options.items():
+ if isinstance(val, basestring):
+ val = [val, ]
+ ret.setdefault(key, []).extend(val)
+
+ self.parent.log_message('options: %s' % ret)
+ else:
+ ret = opts
+ return ret
+
def get_prop(self, uri, ns, propname):
""" return the value of a given property