[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
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -72,29 +72,6 @@ def redirect_with_hash(url, code=303):
|
||||
return werkzeug.utils.redirect(url, code)
|
||||
return "<html><head><script>window.location = '%s' + location.hash;</script></head></html>" % 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
|
||||
|
||||
Reference in New Issue
Block a user