diff options
Diffstat (limited to 'paste')
| -rw-r--r-- | paste/default_config.conf | 3 | ||||
| -rw-r--r-- | paste/makeapp.py | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/paste/default_config.conf b/paste/default_config.conf index 40fa146..2812bc1 100644 --- a/paste/default_config.conf +++ b/paste/default_config.conf @@ -6,6 +6,9 @@ framework = 'default' # The first middleware in this list is wrapped most closely around # the application: middleware = [] +# This middleware comes right after config_middleware, and before all +# other middleware: +important_middleware = [] port = 8080 host = 'localhost' verbose = False diff --git a/paste/makeapp.py b/paste/makeapp.py index fddc254..9beae7b 100644 --- a/paste/makeapp.py +++ b/paste/makeapp.py @@ -33,5 +33,11 @@ def apply_default_middleware(app, conf): app = errormiddleware.ErrorMiddleware(app) if conf.get('lint', False): app = lint.middleware(app) + for middleware in conf.get('important_middleware', []): + if isinstance(middleware, (str, unicode)): + middleware = import_string.eval_import(middleware) + app = middleware(app) + if conf.get('lint', False): + app = lint.middleware(app) app = configmiddleware.ConfigMiddleware(app, conf) return app |
