Commits

Daniel Holth committed f5d04f7

Paste Deploy entry points for all Flickzeug middleware.

  • Participants
  • Parent commits 3ce1541

Comments (0)

Files changed (3)

File flickzeug/debug/__init__.py

             else:
                 yield 'Server Error'
 
-
-def debugged_application_factory(global_config, **kw):
-    from paste.deploy.converters import asbool
-    kw.update(global_config)
-    evalex = asbool(kw.get('flickzeug.evalex', kw.get('evalex', False)))
-    def factory(*args, **kwargs):
-        return DebuggedApplication(*args, evalex=evalex, **kwargs)
-    return factory
-

File flickzeug/utils/entry_points.py

+"""
+Paste Deploy compatibility.
+"""
+
+def debugger_filter_factory(global_config, **kw):
+    """Debugged application."""
+    from paste.deploy.converters import asbool
+    from flickzeug.debug import DebuggedApplication
+    kw.update(global_config)
+    evalex = asbool(kw.get('flickzeug.evalex', kw.get('evalex', False)))
+    def factory(*args, **kwargs):
+        return DebuggedApplication(*args, evalex=evalex, **kwargs)
+    return factory
+
+def profiler_filter_factory(global_config, profile_data_path, app_path='/_profiler', **kw):
+    """Profiled application."""
+    from flickzeug.profiling.profiler import Profiler
+    def factory(*args, **kwargs):
+        return Profiler(*args, profile_data_path=profile_data_path, app_path=app_path)
+    return factory
+
+def profiler_simple_filter_factory(global_config, **kw):
+    """Profiled application (simple)."""
+    from flickzeug.profiling.simple import SimpleProfiler
+    return SimpleProfiler
+
+def leakfinder_filter_factory(global_config, **kw):
+    """Leak finder."""
+    from flickzeug.leakfinder.leak import LeakFinder
+    # LeakFinder accepts 'exclude=...' as a function.
+    def factory(*args, **kwargs):
+        return LeakFinder(*args, **kwargs)
+    return factory
+
     },
     entry_points={
         'paste.filter_factory' : [
-            'debug=flickzeug.debug:debugged_application_factory'
+            'debugger=flickzeug.utils.entry_points:debugger_filter_factory',
+            'profiler=flickzeug.utils.entry_points:profiler_filter_factory',
+            'profiler_simple=flickzeug.utils.entry_points:profiler_simple_filter_factory',
+            'leakfinder=flickzeug.utils.entry_points:leakfinder_filter_factory',
         ]
     },
     include_package_data=True,