diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-10-12 13:40:20 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-10-12 13:40:20 +0300 |
| commit | f842ccc1ec3beba28238f5027d2c80d23c98e335 (patch) | |
| tree | 64217d248a72ed79ffe237ab8a57109e6a93ad66 /addons/document_webdav/document_webdav.py | |
| parent | 1fe7eb3e8f1454b5846e4e0f432d513813030300 (diff) | |
Doc webdav: context for DAV properties, dynamic folders
bzr revid: p_christ@hol.gr-20101012104020-izmzgobc2kbxb2cj
Diffstat (limited to 'addons/document_webdav/document_webdav.py')
| -rw-r--r-- | addons/document_webdav/document_webdav.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/addons/document_webdav/document_webdav.py b/addons/document_webdav/document_webdav.py index 6cc565016ea..28b70c8d7e4 100644 --- a/addons/document_webdav/document_webdav.py +++ b/addons/document_webdav/document_webdav.py @@ -21,6 +21,7 @@ from osv import osv, fields import nodes +from tools import config class document_davdir(osv.osv): _inherit = 'document.directory' @@ -30,12 +31,15 @@ class document_davdir(osv.osv): 'dav_prop_ids': fields.one2many('document.webdav.dir.property', 'dir_id', 'DAV properties'), } - def get_node_class(self, cr, uid, ids, dbro=None, context=None): + def get_node_class(self, cr, uid, ids, dbro=None, dynamic=False, context=None): # Note: in this function, nodes come from document_webdav/nodes.py ! if dbro is None: dbro = self.browse(cr, uid, ids, context=context) - if dbro.type == 'directory': + if dynamic: + assert dbro.type == 'directory' + return nodes.node_res_obj + elif dbro.type == 'directory': return nodes.node_dir elif dbro.type == 'ressource': return nodes.node_res_dir @@ -44,6 +48,14 @@ class document_davdir(osv.osv): def _prepare_context(self, cr, uid, nctx, context): nctx.node_file_class = nodes.node_file + # We can fill some more fields, but avoid any expensive function + # that might be not worth preparing. + nctx.extra_ctx['webdav_path'] = '/'+config.get_misc('webdav','vdir','webdav') + usr_obj = self.pool.get('res.users') + res = usr_obj.read(cr, uid, uid, ['login']) + if res: + nctx.extra_ctx['username'] = res['login'] + # TODO group return def _locate_child(self, cr, uid, root_id, uri,nparent, ncontext): |
