From b5b625932abd6d546f1a498826c210c72c7d86d9 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Tue, 5 Mar 2013 22:14:33 +0100 Subject: [PATCH] db_monodb use the new implementation bzr revid: al@openerp.com-20130305211433-cz7jopkmehxbbbsh --- addons/web/controllers/main.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 1b28b3f8503..e51deacd57b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -93,17 +93,6 @@ def db_list(req): dbs = [i for i in dbs if re.match(r, i)] return dbs -def db_monodb(req): - # if only one db exists, return it else return False - try: - dbs = db_list(req) - if len(dbs) == 1: - return dbs[0] - except xmlrpclib.Fault: - # ignore access denied - pass - return False - def db_monodb_list(req): try: dbs = db_list(req) @@ -117,12 +106,16 @@ def db_monodb_list(req): db = req.httprequest.cookies.get('last_used_database') or first_db redirect = False - if db and db_url is not db and len(dbs) > 1: + if db and db_url != db and len(dbs) > 1: query = dict(urlparse.parse_qsl(req.httprequest.query_string, keep_blank_values=True)) query.update({ 'db': db }) redirect = req.httprequest.path + '?' + urllib.urlencode(query) return (db, dbs, redirect) +def db_monodb(req): + # if only one db exists, return it else return False + return db_monodb_list(req)[0] + def module_topological_sort(modules): """ Return a list of module names sorted so that their dependencies of the modules are listed before the module itself