summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-07-03 00:07:47 +0000
committerianb <devnull@localhost>2005-07-03 00:07:47 +0000
commit3936af5f97328da6f695ac84260e09d8c37b8f68 (patch)
tree45cb2796bb93804d384d38fe068d59d9e43c19a0 /paste
parent1db60294e1818019d09794dad6032cc1376dcf52 (diff)
downloadpaste-3936af5f97328da6f695ac84260e09d8c37b8f68.tar.gz
Added new configuration, important_middleware, which gets applied very early in the middleware stack
Diffstat (limited to 'paste')
-rw-r--r--paste/default_config.conf3
-rw-r--r--paste/makeapp.py6
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