diff --git a/addons/web/common/http.py b/addons/web/common/http.py index 84febdbebb3..9b86bbe5364 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -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):