diff options
| author | Harry (Open ERP) <hmo@tinyerp.com> | 2010-04-28 12:00:21 +0530 |
|---|---|---|
| committer | Harry (Open ERP) <hmo@tinyerp.com> | 2010-04-28 12:00:21 +0530 |
| commit | 2c4b096a4b0fb4e30cc1e5e4305e39d7aeb9c6d2 (patch) | |
| tree | 54c1a0404ab507585818419f5e9242a719f44282 /addons/document/document_directory.py | |
| parent | 5a0c2383ce19bdad644e34a080516f0029614cf5 (diff) | |
| parent | 95fc4188ce1d5c867c09db6750ed05aee5954587 (diff) | |
[MERGE]
bzr revid: hmo@tinyerp.com-20100428063021-z66ib99xgpu4nzpg
Diffstat (limited to 'addons/document/document_directory.py')
| -rw-r--r-- | addons/document/document_directory.py | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 19c4489132c..25e172d2817 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -95,8 +95,7 @@ class document_directory(osv.osv): 'user_id': lambda self,cr,uid,ctx: uid, 'domain': lambda self,cr,uid,ctx: '[]', 'type': lambda *args: 'directory', - 'ressource_id': lambda *a: 0, - 'parent_id': _get_root_directory, + 'ressource_id': lambda *a: 0, 'storage_id': _get_def_storage, } _sql_constraints = [ @@ -204,52 +203,11 @@ class document_directory(osv.osv): raise - def _locate_child(self, cr,uid, root_id, uri,nparent, ncontext): + def _locate_child(self, cr, uid, root_id, uri,nparent, ncontext): """ try to locate the node in uri, Return a tuple (node_dir, remaining_path) """ - did = root_id - duri = uri - path = [] - context = ncontext.context - while len(duri): - nid = self.search(cr,uid,[('parent_id','=',did),('name','=',duri[0]),('type','=','directory')], context=context) - if not nid: - break - if len(nid)>1: - print "Duplicate dir? p= %d, n=\"%s\"" %(did,duri[0]) - path.append(duri[0]) - duri = duri[1:] - did = nid[0] - root_node = did and self.browse(cr,uid,did, context) or False - return (nodes.node_dir(path, nparent,ncontext, root_node), duri) - - - nid = self.search(cr,uid,[('parent_id','=',did),('name','=',duri[0]),('type','=','ressource')], context=context) - if nid: - if len(nid)>1: - print "Duplicate dir? p= %d, n=\"%s\"" %(did,duri[0]) - path.append(duri[0]) - duri = duri[1:] - did = nid[0] - return nodes.node_res_dir(path, nparent,ncontext,self.browse(cr,uid,did, context)) - - # Here, we must find the appropriate non-dir child.. - # Chech for files: - fil_obj = self.pool.get('ir.attachment') - nid = fil_obj.search(cr,uid,[('parent_id','=',did),('name','=',duri[0])],context=context) - if nid: - if len(duri)>1: - # cannot treat child as a dir - return None - if len(nid)>1: - print "Duplicate file?",did,duri[0] - path.append(duri[0]) - return nodes.node_file(path,nparent,ncontext,fil_obj.browse(cr,uid,nid[0],context)) - - print "nothing found:",did, duri - #still, nothing found - return None + return (nodes.node_database(context=ncontext), uri) def old_code(): if not uri: |
