diff options
| author | Harry (Open ERP) <hmo@tinyerp.com> | 2010-03-17 11:31:45 +0530 |
|---|---|---|
| committer | Harry (Open ERP) <hmo@tinyerp.com> | 2010-03-17 11:31:45 +0530 |
| commit | 586a4ef79aa7f87ea55ccc44c727eaffb53c730b (patch) | |
| tree | 9d6e447af4e1662a6eb451fd73a27fecb9599c25 /addons/document/nodes.py | |
| parent | 0db347d65f9c67f4b114a96874ea120cf7eacdee (diff) | |
| parent | b6b93ef9d0eee59855f509c844bcc1a18e7bbb8d (diff) | |
[MERGE] from lp:~openerp/openobject-addons/trunk/
bzr revid: hmo@tinyerp.com-20100317060145-grxjqr8b90u4nn5d
Diffstat (limited to 'addons/document/nodes.py')
| -rw-r--r-- | addons/document/nodes.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 543610a0d22..c7eb80c0a45 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -49,18 +49,17 @@ class node_context(object): context """ cached_roots = {} - def __init__(self, cr, uid, context=None): - # we don't cache the cr! + def __init__(self, cr, uid, context=None): self.dbname = cr.dbname self.uid = uid self.context = context self._dirobj = pooler.get_pool(cr.dbname).get('document.directory') assert self._dirobj - self.rootdir = self._dirobj._get_root_directory(cr,uid,context) + self.rootdir = False #self._dirobj._get_root_directory(cr,uid,context) def get_uri(self, cr, uri): """ Although this fn passes back to doc.dir, it is needed since - it is a potential caching point """ + it is a potential caching point """ (ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self) while duri: ndir = ndir.child(cr, duri[0]) @@ -168,23 +167,23 @@ class node_dir(node_class): our_type = 'collection' def __init__(self,path, parent, context, dirr, dctx=None): super(node_dir,self).__init__(path, parent,context) - self.dir_id = dirr.id + self.dir_id = dirr and dirr.id or False #todo: more info from dirr self.mimetype = 'application/x-directory' # 'httpd/unix-directory' - self.create_date = dirr.create_date - self.domain = dirr.domain - self.res_model = dirr.ressource_type_id and dirr.ressource_type_id.model or False + self.create_date = dirr and dirr.create_date or False + self.domain = dirr and dirr.domain or [] + self.res_model = dirr and dirr.ressource_type_id and dirr.ressource_type_id.model or False # TODO: the write date should be MAX(file.write).. - self.write_date = dirr.write_date or dirr.create_date + self.write_date = dirr and (dirr.write_date or dirr.create_date) or False self.content_length = 0 if dctx: self.dctx.update(dctx) dc2 = self.context.context dc2.update(self.dctx) dc2['dir_id'] = self.dir_id - self.displayname = dirr.name - if dirr.dctx_ids: + self.displayname = dirr and dirr.name or False + if dirr and dirr.dctx_ids: for dfld in dirr.dctx_ids: try: self.dctx['dctx_' + dfld.field] = safe_eval(dfld.expr,dc2) |
