db_monodb use the new implementation

bzr revid: al@openerp.com-20130305211433-cz7jopkmehxbbbsh
This commit is contained in:
Antony Lesuisse 2013-03-05 22:14:33 +01:00
parent 7b154aa8e0
commit b5b625932a
1 changed files with 5 additions and 12 deletions

View File

@ -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