[IMP] document :- docuemnt parent_id retrun False instead of None, and improvement in content_index file

bzr revid: ysa@tinyerp.co.in-20100310105334-arawdstqdjeiqmtf
This commit is contained in:
Ysa (Open ERP) 2010-03-10 16:23:34 +05:30
parent de122606b0
commit 65ae507923
3 changed files with 10 additions and 4 deletions

View File

@ -158,7 +158,8 @@ class contentIndex():
os.write(fd, content)
os.close(fd)
fp = Popen(['file','-b','--mime-type',fname], shell=False, stdout=PIPE).stdout
#fp = Popen(['file','-b','--mime-type',fname], shell=False, stdout=PIPE).stdout
fp = Popen(['file','-b',fname], shell=False, stdout=PIPE).stdout
result = fp.read()
fp.close()
mime2 = result.strip()

View File

@ -65,14 +65,14 @@ class document_directory(osv.osv):
objid=self.pool.get('ir.model.data')
try:
mid = objid._get_id(cr, uid, 'document', 'dir_root')
return None # TODO: check why not display root dir
return False # TODO: check why not display root dir
if not mid:
return None
return False
except Exception, e:
import netsvc
logger = netsvc.Logger()
logger.notifyChannel("document", netsvc.LOG_WARNING, 'Cannot set directory root:'+ str(e))
return None
return False
return objid.browse(cr, uid, mid, context=context).res_id
def _get_def_storage(self,cr,uid,context=None):

View File

@ -631,6 +631,11 @@ class node_file(node_class):
the browse object. """
# this is where storage kicks in..
stor = self.storage_id
if not stor:
data_obj = self.context._dirobj.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db')
if data_id:
stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id
assert stor
stobj = self.context._dirobj.pool.get('document.storage')
return stobj.set_data(cr,self.context.uid,stor, self, data, self.context.context, fil_obj)