From 6374d8a9e1823d17e737a260f0e324ce35c92bf7 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Tue, 5 Nov 2013 23:36:52 +0100 Subject: [PATCH] fix application profiling --- isso/__init__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/isso/__init__.py b/isso/__init__.py index 19b9403..79ae782 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -169,15 +169,18 @@ def make_app(conf=None): logger.warn("unable to connect to HTTP server") if isso.conf.getboolean("server", "profile"): - from werkzeug.contrib.profiler import ProfilerMiddleware - isso = ProfilerMiddleware(isso, sort_by=("cumtime", ), restrictions=("isso/(?!lib)", )) + from werkzeug.contrib.profiler import ProfilerMiddleware as Profiler + ProfilerMiddleware = lambda app: Profiler(app, sort_by=("cumtime", ), restrictions=("isso/(?!lib)", 10)) + else: + ProfilerMiddleware = lambda app: app app = ProxyFix( wsgi.SubURI( wsgi.CORSMiddleware( - SharedDataMiddleware(isso, { - '/js': join(dirname(__file__), 'js/'), - '/css': join(dirname(__file__), 'css/')}), + SharedDataMiddleware( + ProfilerMiddleware(isso), { + '/js': join(dirname(__file__), 'js/'), + '/css': join(dirname(__file__), 'css/')}), list(isso.conf.getiter("general", "host"))))) return app