From ad31f812bc437b24f3ad0d25795b8b6de980d8ea Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 29 Jun 2010 17:03:11 +0300 Subject: [PATCH] Document_ftp: Don't use the open() method, but the get_data() bzr revid: p_christ@hol.gr-20100629140311-7bvmbrc2t7gjyn1g --- .../document_ftp/ftpserver/abstracted_fs.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/document_ftp/ftpserver/abstracted_fs.py b/addons/document_ftp/ftpserver/abstracted_fs.py index 60b3c24c7a9..7d4eccb05fd 100644 --- a/addons/document_ftp/ftpserver/abstracted_fs.py +++ b/addons/document_ftp/ftpserver/abstracted_fs.py @@ -311,15 +311,11 @@ class abstracted_fs: raise OSError(1, 'Operation not permited.') # Reading operation cr = pooler.get_db(node.context.dbname).cursor() - res = False - #try: - if node.type not in ('collection','database'): - res = node.open(cr, mode) - #except: - # pass - cr.close() - if not res: - raise OSError(1, 'Operation not permited.') + try: + res = StringIO.StringIO(node.get_data(cr)) + res.name = node + finally: + cr.close() return res # ok, but need test more @@ -423,10 +419,14 @@ class abstracted_fs: return None try: db,pool = pooler.get_db_and_pool(dbname) - except: + except Exception: raise OSError(1, 'Operation not permited.') cr = db.cursor() - uid = security.login(dbname, self.username, self.password) + try: + uid = security.login(dbname, self.username, self.password) + except Exception: + cr.close() + raise if not uid: raise OSError(2, 'Authentification Required.') return cr, uid, pool