diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -47,9 +47,9 @@ def make_app(global_conf, full_stack=Tru app = SessionMiddleware(app, config) # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) - - app = SimpleHg(app, config) - app = SimpleGit(app, config) + if asbool(config['pdebug']): + from rhodecode.lib.profiler import ProfilingMiddleware + app = ProfilingMiddleware(app) if asbool(full_stack): # Handle Python exceptions @@ -74,6 +74,11 @@ def make_app(global_conf, full_stack=Tru app = Cascade([static_app, app]) app = make_gzip_middleware(app, global_conf, compress_level=1) + # we want our low level middleware to get to the request ASAP. We don't + # need any pylons stack middleware in them + app = SimpleHg(app, config) + app = SimpleGit(app, config) + app.config = config return app