diff options
| author | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
|---|---|---|
| committer | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
| commit | b0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch) | |
| tree | e78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/document/document_directory.py | |
| parent | 46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff) | |
| parent | 2319190c5a20cb8095f85cacca89a33164ba93d7 (diff) | |
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/document/document_directory.py')
| -rw-r--r-- | addons/document/document_directory.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 8c50164701b..75cb2e5098e 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -80,10 +80,10 @@ class document_directory(osv.osv): return False return objid.browse(cr, uid, mid, context=context).res_id - def _get_def_storage(self,cr,uid,context=None): + def _get_def_storage(self, cr, uid, context=None): if context and context.has_key('default_parent_id'): # Use the same storage as the parent.. - diro = self.browse(cr,uid,context['default_parent_id']) + diro = self.browse(cr, uid, context['default_parent_id']) if diro.storage_id: return diro.storage_id.id objid=self.pool.get('ir.model.data') @@ -121,7 +121,7 @@ class document_directory(osv.osv): """ Return the full path to this directory, in a list, root first """ def _parent(dir_id, path): - parent=self.browse(cr,uid,dir_id) + parent=self.browse(cr, uid, dir_id) if parent.parent_id and not parent.ressource_parent_type_id: _parent(parent.parent_id.id,path) path.append(parent.name) @@ -132,12 +132,12 @@ class document_directory(osv.osv): _parent(dir_id, path) return path - def ol_get_resource_path(self,cr,uid,dir_id,res_model,res_id): + def ol_get_resource_path(self, cr, uid, dir_id, res_model, res_id): # this method will be used in process module # to be need test and Improvement if resource dir has parent resource (link resource) path=[] def _parent(dir_id,path): - parent=self.browse(cr,uid,dir_id) + parent=self.browse(cr, uid, dir_id) if parent.parent_id and not parent.ressource_parent_type_id: _parent(parent.parent_id.id,path) path.append(parent.name) @@ -146,10 +146,10 @@ class document_directory(osv.osv): return path directory=self.browse(cr,uid,dir_id) - model_ids=self.pool.get('ir.model').search(cr,uid,[('model','=',res_model)]) + model_ids=self.pool.get('ir.model').search(cr, uid, [('model','=',res_model)]) if directory: _parent(dir_id,path) - path.append(self.pool.get(directory.ressource_type_id.model).browse(cr,uid,res_id).name) + path.append(self.pool.get(directory.ressource_type_id.model).browse(cr, uid, res_id).name) #user=self.pool.get('res.users').browse(cr,uid,uid) #return "ftp://%s:%s@localhost:%s/%s/%s"%(user.login,user.password,config.get('ftp_server_port',8021),cr.dbname,'/'.join(path)) # No way we will return the password! @@ -197,7 +197,7 @@ class document_directory(osv.osv): context['lang'] = lang try: #just instrumentation - return nodes.get_node_context(cr, uid, context).get_uri(cr,uri) + return nodes.get_node_context(cr, uid, context).get_uri(cr, uri) except Exception,e: print "exception: ",e raise @@ -237,15 +237,15 @@ class document_directory(osv.osv): default ={} name = self.read(cr, uid, [id])[0]['name'] default.update({'name': name+ " (copy)"}) - return super(document_directory,self).copy(cr,uid,id,default,context) + return super(document_directory,self).copy(cr, uid, id, default, context) - def _check_duplication(self, cr, uid,vals,ids=[],op='create'): + def _check_duplication(self, cr, uid, vals, ids=[], op='create'): name=vals.get('name',False) parent_id=vals.get('parent_id',False) ressource_parent_type_id=vals.get('ressource_parent_type_id',False) ressource_id=vals.get('ressource_id',0) if op=='write': - for directory in self.browse(cr,uid,ids): + for directory in self.browse(cr, uid, ids): if not name: name=directory.name if not parent_id: @@ -263,12 +263,12 @@ class document_directory(osv.osv): return False return True def write(self, cr, uid, ids, vals, context=None): - if not self._check_duplication(cr,uid,vals,ids,op='write'): + if not self._check_duplication(cr, uid, vals, ids, op='write'): raise osv.except_osv(_('ValidateError'), _('Directory name must be unique!')) - return super(document_directory,self).write(cr,uid,ids,vals,context=context) + return super(document_directory,self).write(cr, uid, ids, vals, context=context) def create(self, cr, uid, vals, context=None): - if not self._check_duplication(cr,uid,vals): + if not self._check_duplication(cr, uid, vals): raise osv.except_osv(_('ValidateError'), _('Directory name must be unique!')) if vals.get('name',False) and (vals.get('name').find('/')+1 or vals.get('name').find('@')+1 or vals.get('name').find('$')+1 or vals.get('name').find('#')+1) : raise osv.except_osv(_('ValidateError'), _('Directory name contains special characters!')) |
