|
a/Allura/allura/config/middleware.py |
|
b/Allura/allura/config/middleware.py |
|
... |
|
... |
109 |
# Required for sessions
|
109 |
# Required for sessions
|
110 |
app = SessionMiddleware(app, config)
|
110 |
app = SessionMiddleware(app, config)
|
111 |
# Converts exceptions to HTTP errors, shows traceback in debug mode
|
111 |
# Converts exceptions to HTTP errors, shows traceback in debug mode
|
112 |
app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
|
112 |
app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
|
113 |
# Redirect some status codes to /error/document
|
113 |
# Redirect some status codes to /error/document
|
|
|
114 |
if config.get('override_root') != 'task':
|
|
|
115 |
# "task" wsgi would get a 2nd request to /error/document if we used this middleware
|
114 |
if asbool(config['debug']):
|
116 |
if asbool(config['debug']):
|
115 |
app = StatusCodeRedirect(app, base_config.handle_status_codes)
|
117 |
app = StatusCodeRedirect(app, base_config.handle_status_codes)
|
116 |
else:
|
118 |
else:
|
117 |
app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
|
119 |
app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
|
118 |
# Redirect 401 to the login page
|
120 |
# Redirect 401 to the login page
|
119 |
app = LoginRedirectMiddleware(app)
|
121 |
app = LoginRedirectMiddleware(app)
|
120 |
# Add instrumentation
|
122 |
# Add instrumentation
|
121 |
app = AlluraTimerMiddleware(app, app_conf)
|
123 |
app = AlluraTimerMiddleware(app, app_conf)
|
122 |
# Clear cookies when the CSRF field isn't posted
|
124 |
# Clear cookies when the CSRF field isn't posted
|