From: Antony Lesuisse Date: Tue, 5 Mar 2013 21:14:33 +0000 (+0100) Subject: db_monodb use the new implementation X-Git-Tag: InsPy_master01~1436^2~14^2~6 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;ds=sidebyside;h=b5b625932abd6d546f1a498826c210c72c7d86d9;p=odoo%2Fodoo.git db_monodb use the new implementation bzr revid: al@openerp.com-20130305211433-cz7jopkmehxbbbsh --- diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 1b28b3f..e51deac 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