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
This commit is contained in:
P. Christeas
2010-06-23 13:49:56 +03:00
parent f96ac9db02
commit 0be3a0757c
+13 -7
View File
@@ -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):