From 4566b4174e02e4a980f23f95cf074b354aa6299f Mon Sep 17 00:00:00 2001 From: hmo-tinyerp <> Date: Tue, 16 Dec 2008 18:05:15 +0530 Subject: [PATCH] fixed bug : unicode problem on display path bzr revid: hmo-tinyerp-20081216123515-qh0zve76cto3mqsy --- addons/document/document.py | 6 +++++- addons/document/ftpserver/abstracted_fs.py | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/document/document.py b/addons/document/document.py index afb466c983a..eb5affaa853 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -37,6 +37,7 @@ import random import string from psycopg2 import Binary from tools import config +import tools def random_name(): random.seed() @@ -497,6 +498,9 @@ class document_file(osv.osv): result[id]='' else: result[id] = '' + if context.get('bin_size', False): + result[id] = tools.human_size(len(result[id])) + return result # @@ -539,7 +543,7 @@ class document_file(osv.osv): 'create_date': fields.datetime('Date Created', readonly=True), 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), 'store_method': fields.selection([('db','Database'),('fs','Filesystem'),('link','Link')], "Storing Method"), - 'datas': fields.function(_data_get,method=True,store=True,fnct_inv=_data_set,string='File Content',type="binary"), + 'datas': fields.function(_data_get,method=True,fnct_inv=_data_set,string='File Content',type="binary"), 'store_fname': fields.char('Stored Filename', size=200), 'res_model': fields.char('Attached Model', size=64), #res_model 'res_id': fields.integer('Attached ID'), #res_id diff --git a/addons/document/ftpserver/abstracted_fs.py b/addons/document/ftpserver/abstracted_fs.py index c83fbb61d05..69aecb284c4 100644 --- a/addons/document/ftpserver/abstracted_fs.py +++ b/addons/document/ftpserver/abstracted_fs.py @@ -74,7 +74,7 @@ class abstracted_fs: # Ok def db_list(self): - return pooler.pool_dic.keys() + #return pooler.pool_dic.keys() s = netsvc.LocalService('db') result = s.list() self.db_name_list = [] @@ -95,8 +95,7 @@ class abstracted_fs: if cr is not None: cr.close() #if db is not None: - # pooler.close_db(db_name) - print 'Return', self.db_name_list + # pooler.close_db(db_name) return self.db_name_list # Ok @@ -689,7 +688,7 @@ class abstracted_fs: # formatting is matched with proftpd ls output yield "%s %3s %-8s %-8s %8s %s %s\r\n" %(perms, nlinks, uname, gname, - size, mtime, file.path.split('/')[-1]) + size, mtime, file.path.encode('ascii','replace').split('/')[-1]) # Ok def format_mlsx(self, basedir, listing, perms, facts, ignore_err=True):