[IMP] move session_context above wsgi app

bzr revid: al@openerp.com-20120813232405-qna3d48h6j8tfks1
This commit is contained in:
Antony Lesuisse 2012-08-14 01:24:05 +02:00
parent 01d89b15b7
commit e51d72422c
1 changed files with 18 additions and 20 deletions

View File

@ -329,13 +329,30 @@ def httprequest(f):
http_handler.exposed = True
return http_handler
#----------------------------------------------------------
# OpenERP Web Controller registration with a metaclass
#----------------------------------------------------------
addons_module = {}
addons_manifest = {}
controllers_class = []
controllers_object = {}
controllers_path = {}
class ControllerType(type):
def __init__(cls, name, bases, attrs):
super(ControllerType, cls).__init__(name, bases, attrs)
controllers_class.append(("%s.%s" % (cls.__module__, cls.__name__), cls))
class Controller(object):
__metaclass__ = ControllerType
#----------------------------------------------------------
# OpenERP Web Session context manager
#----------------------------------------------------------
STORES = {}
@contextlib.contextmanager
def session_context(request, storage_path, session_cookie='sessionid'):
def session_context(request, storage_path, session_cookie='httpsessionid'):
session_store, session_lock = STORES.get(storage_path, (None, None))
if not session_store:
session_store = werkzeug.contrib.sessions.FilesystemSessionStore( storage_path)
@ -400,27 +417,9 @@ def session_context(request, storage_path, session_cookie='sessionid'):
session_store.save(request.session)
#----------------------------------------------------------
# OpenERP Web Controller registration with a metaclass
#----------------------------------------------------------
addons_module = {}
addons_manifest = {}
controllers_class = []
controllers_object = {}
controllers_path = {}
class ControllerType(type):
def __init__(cls, name, bases, attrs):
super(ControllerType, cls).__init__(name, bases, attrs)
controllers_class.append(("%s.%s" % (cls.__module__, cls.__name__), cls))
class Controller(object):
__metaclass__ = ControllerType
#----------------------------------------------------------
# OpenERP Web WSGI Application
#----------------------------------------------------------
class DisableCacheMiddleware(object):
def __init__(self, app):
self.app = app
@ -578,7 +577,6 @@ class Root(object):
#----------------------------------------------------------
# OpenERP Web Client lib
#----------------------------------------------------------
class LibException(Exception):
""" Base of all client lib exceptions """
def __init__(self,code=None,message=None):