From 1daa7db8b06e011c09fab34f309a5d24bf524a36 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 30 Jan 2014 10:21:52 +0100 Subject: [PATCH] [REM] Removed disabled_db=True from ir_http's auth="none" [MOV] ensure_db() helper from http module to web module Since we removed auth="admin" in favor of auth="none" with explicit superuser id usage, the disable_db clause in auth_none() has only sense for the /web and /web/login routes. The web module is an exception because it's routes are registered for the nodb dispatching. This is why the ensure_db() helper is moved to web client and will take care of the web's auth="none" routes that needs a db to work with bzr revid: fme@openerp.com-20140130092152-h6elwf2yerhd9xey --- openerp/addons/base/ir/ir_http.py | 1 - openerp/http.py | 23 ----------------------- 2 files changed, 24 deletions(-) diff --git a/openerp/addons/base/ir/ir_http.py b/openerp/addons/base/ir/ir_http.py index a022bb0edec..01999ebb9ec 100644 --- a/openerp/addons/base/ir/ir_http.py +++ b/openerp/addons/base/ir/ir_http.py @@ -62,7 +62,6 @@ class ir_http(osv.AbstractModel): raise http.SessionExpiredException("Session expired") def _auth_method_none(self): - request.disable_db = True request.uid = None def _auth_method_public(self): diff --git a/openerp/http.py b/openerp/http.py index 8823f9ca9ce..94e49ba7731 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -72,29 +72,6 @@ def redirect_with_hash(url, code=303): return werkzeug.utils.redirect(url, code) return "" % url -def ensure_db(with_registry=False, redirect='/web/database/selector'): - db = request.params.get('db') - # if db not provided, use the session one - if not db: - db = request.session.db - - # if no database provided and no database in session, use monodb - if not db: - db = db_monodb(request.httprequest) - - # if no db can be found til here, send to the database selector - # the database selector will redirect to database manager if needed - if not db: - werkzeug.exceptions.abort(werkzeug.utils.redirect(redirect, 303)) - - # always switch the session to the computed db - if db != request.session.db: - request.session.logout() - request.session.db = db - - if with_registry: - request.disable_db = False - class WebRequest(object): """ Parent class for all OpenERP Web request types, mostly deals with initialization and setup of the request object (the dispatching itself has