From 0be3a0757ca31d9abe8f78f86c3606200d546941 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 23 Jun 2010 13:49:56 +0300 Subject: [PATCH] Doc webdav: fix at listing of dbs This is not a complete fix yet, but handles the case when one of the scanned db's is not a proper OpenERP one (happens if a db has same user as in the openerp conf, or if openerp db is not initialized properly). bzr revid: p_christ@hol.gr-20100623104956-w5r3n035ozvz0h0v --- addons/document_webdav/dav_fs.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/addons/document_webdav/dav_fs.py b/addons/document_webdav/dav_fs.py index 51368388734..a0d70704579 100644 --- a/addons/document_webdav/dav_fs.py +++ b/addons/document_webdav/dav_fs.py @@ -140,13 +140,19 @@ class openerp_dav_handler(dav_interface): result = s.exp_list() self.db_name_list=[] for db_name in result: - db = pooler.get_db_only(db_name) - cr = db.cursor() - cr.execute("select id from ir_module_module where name = 'document' and state='installed' ") - res=cr.fetchone() - if res and len(res): - self.db_name_list.append(db_name) - cr.close() + cr = None + try: + db = pooler.get_db_only(db_name) + cr = db.cursor() + cr.execute("SELECT id FROM ir_module_module WHERE name = 'document' AND state='installed' ") + res=cr.fetchone() + if res and len(res): + self.db_name_list.append(db_name) + except Exception, e: + self.parent.log_error("Exception in db list: %s" % e) + finally: + if cr: + cr.close() return self.db_name_list def get_childs(self, uri, filters=None):