Paste Deploy entry points for all Flickzeug middleware.

2 years ago

author
Daniel Holth <dholth@fastmail.fm>
date
Thu Mar 11 22:59:36 2010 -0500
changeset 57
f5d04f7b469f
parent 56
3ce154155bae
child 58
d39add58df11

Paste Deploy entry points for all Flickzeug middleware.

flickzeug/debug/__init__.pyfile | annotate | diff | revisions
flickzeug/utils/entry_points.pyfile | annotate | diff | revisions
setup.pyfile | annotate | diff | revisions
     1.1 --- a/flickzeug/debug/__init__.py	Fri Feb 19 16:47:34 2010 -0500
     1.2 +++ b/flickzeug/debug/__init__.py	Thu Mar 11 22:59:36 2010 -0500
     1.3 @@ -208,12 +208,3 @@
     1.4              else:
     1.5                  yield 'Server Error'
     1.6  
     1.7 -
     1.8 -def debugged_application_factory(global_config, **kw):
     1.9 -    from paste.deploy.converters import asbool
    1.10 -    kw.update(global_config)
    1.11 -    evalex = asbool(kw.get('flickzeug.evalex', kw.get('evalex', False)))
    1.12 -    def factory(*args, **kwargs):
    1.13 -        return DebuggedApplication(*args, evalex=evalex, **kwargs)
    1.14 -    return factory
    1.15 -
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/flickzeug/utils/entry_points.py	Thu Mar 11 22:59:36 2010 -0500
     2.3 @@ -0,0 +1,34 @@
     2.4 +"""
     2.5 +Paste Deploy compatibility.
     2.6 +"""
     2.7 +
     2.8 +def debugger_filter_factory(global_config, **kw):
     2.9 +    """Debugged application."""
    2.10 +    from paste.deploy.converters import asbool
    2.11 +    from flickzeug.debug import DebuggedApplication
    2.12 +    kw.update(global_config)
    2.13 +    evalex = asbool(kw.get('flickzeug.evalex', kw.get('evalex', False)))
    2.14 +    def factory(*args, **kwargs):
    2.15 +        return DebuggedApplication(*args, evalex=evalex, **kwargs)
    2.16 +    return factory
    2.17 +
    2.18 +def profiler_filter_factory(global_config, profile_data_path, app_path='/_profiler', **kw):
    2.19 +    """Profiled application."""
    2.20 +    from flickzeug.profiling.profiler import Profiler
    2.21 +    def factory(*args, **kwargs):
    2.22 +        return Profiler(*args, profile_data_path=profile_data_path, app_path=app_path)
    2.23 +    return factory
    2.24 +
    2.25 +def profiler_simple_filter_factory(global_config, **kw):
    2.26 +    """Profiled application (simple)."""
    2.27 +    from flickzeug.profiling.simple import SimpleProfiler
    2.28 +    return SimpleProfiler
    2.29 +
    2.30 +def leakfinder_filter_factory(global_config, **kw):
    2.31 +    """Leak finder."""
    2.32 +    from flickzeug.leakfinder.leak import LeakFinder
    2.33 +    # LeakFinder accepts 'exclude=...' as a function.
    2.34 +    def factory(*args, **kwargs):
    2.35 +        return LeakFinder(*args, **kwargs)
    2.36 +    return factory
    2.37 +
     3.1 --- a/setup.py	Fri Feb 19 16:47:34 2010 -0500
     3.2 +++ b/setup.py	Thu Mar 11 22:59:36 2010 -0500
     3.3 @@ -37,7 +37,10 @@
     3.4      },
     3.5      entry_points={
     3.6          'paste.filter_factory' : [
     3.7 -            'debug=flickzeug.debug:debugged_application_factory'
     3.8 +            'debugger=flickzeug.utils.entry_points:debugger_filter_factory',
     3.9 +            'profiler=flickzeug.utils.entry_points:profiler_filter_factory',
    3.10 +            'profiler_simple=flickzeug.utils.entry_points:profiler_simple_filter_factory',
    3.11 +            'leakfinder=flickzeug.utils.entry_points:leakfinder_filter_factory',
    3.12          ]
    3.13      },
    3.14      include_package_data=True,

mercurial