[DMS]fixing_bug_324823
bzr revid: hmo@tinyerp.com-20090414082015-4bhequho66dy662u
This commit is contained in:
@@ -35,13 +35,13 @@ def _get_month_name(month):
|
||||
|
||||
def _to_unicode(s):
|
||||
try:
|
||||
return s.encode('ascii')
|
||||
return s.decode('utf-8')
|
||||
except UnicodeError:
|
||||
try:
|
||||
return s.decode('utf-8')
|
||||
return s.decode('latin')
|
||||
except UnicodeError:
|
||||
try:
|
||||
return s.decode('latin')
|
||||
return s.encode('ascii')
|
||||
except UnicodeError:
|
||||
return s
|
||||
|
||||
@@ -189,17 +189,18 @@ class abstracted_fs:
|
||||
def ftp2fs(self, path_orig, data):
|
||||
path = self.ftpnorm(path_orig)
|
||||
if path and path=='/':
|
||||
return None
|
||||
path=_to_unicode(path)
|
||||
return None
|
||||
path2 = filter(None,path.split('/'))[1:]
|
||||
(cr, uid, pool) = data
|
||||
if len(path2):
|
||||
path2[-1]=_to_unicode(path2[-1])
|
||||
res = pool.get('document.directory').get_object(cr, uid, path2[:])
|
||||
if not res:
|
||||
raise OSError(2, 'Not such file or directory.')
|
||||
return res
|
||||
|
||||
# Ok
|
||||
def fs2ftp(self, node):
|
||||
def fs2ftp(self, node):
|
||||
res = node and ('/' + node.cr.dbname + '/' + _to_decode(node.path)) or '/'
|
||||
return res
|
||||
|
||||
@@ -742,8 +743,8 @@ class abstracted_fs:
|
||||
except ValueError:
|
||||
mname=_get_month_name(time.strftime("%m"))
|
||||
mtime = mname+' '+time.strftime("%d %H:%M")
|
||||
# formatting is matched with proftpd ls output
|
||||
path=_to_decode(file.path) #file.path.encode('ascii','replace').replace('?','_')
|
||||
# formatting is matched with proftpd ls output
|
||||
path=_to_decode(file.path) #file.path.encode('ascii','replace').replace('?','_')
|
||||
yield "%s %3s %-8s %-8s %8s %s %s\r\n" %(perms, nlinks, uname, gname,
|
||||
size, mtime, path.split('/')[-1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user