|
a/Allura/allura/config/middleware.py |
|
b/Allura/allura/config/middleware.py |
|
... |
|
... |
98 |
if asbool(app_conf.get('activitystream.recording.enabled', False)):
|
98 |
if asbool(app_conf.get('activitystream.recording.enabled', False)):
|
99 |
activitystream.configure(**app_conf)
|
99 |
activitystream.configure(**app_conf)
|
100 |
|
100 |
|
101 |
# Configure EW variable provider
|
101 |
# Configure EW variable provider
|
102 |
ew.render.TemplateEngine.register_variable_provider(get_tg_vars)
|
102 |
ew.render.TemplateEngine.register_variable_provider(get_tg_vars)
|
103 |
|
103 |
|
104 |
# Set FormEncode language to english, as we don't support any other locales
|
104 |
# Set FormEncode language to english, as we don't support any other locales
|
105 |
formencode.api.set_stdtranslation(domain='FormEncode', languages=['en'])
|
105 |
formencode.api.set_stdtranslation(domain='FormEncode', languages=['en'])
|
106 |
|
106 |
|
107 |
# Create base app
|
107 |
# Create base app
|
108 |
base_config = ForgeConfig(root)
|
108 |
base_config = ForgeConfig(root)
|
|
... |
|
... |
159 |
app = MingMiddleware(app)
|
159 |
app = MingMiddleware(app)
|
160 |
# Set up the registry for stacked object proxies (SOPs).
|
160 |
# Set up the registry for stacked object proxies (SOPs).
|
161 |
# streaming=true ensures they won't be cleaned up till
|
161 |
# streaming=true ensures they won't be cleaned up till
|
162 |
# the WSGI application's iterator is exhausted
|
162 |
# the WSGI application's iterator is exhausted
|
163 |
app = RegistryManager(app, streaming=True)
|
163 |
app = RegistryManager(app, streaming=True)
|
164 |
# Converts exceptions to HTTP errors, shows traceback in debug mode
|
|
|
165 |
tg.error.footer_html = '<!-- %s %s -->' # don't use TG footer with extra CSS & images that take time to load
|
|
|
166 |
app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
|
|
|
167 |
# Make sure that the wsgi.scheme is set appropriately when we
|
164 |
# Make sure that the wsgi.scheme is set appropriately when we
|
168 |
# have the funky HTTP_X_SFINC_SSL environ var
|
165 |
# have the funky HTTP_X_SFINC_SSL environ var
|
169 |
if asbool(app_conf.get('auth.method', 'local')=='sfx'):
|
166 |
if asbool(app_conf.get('auth.method', 'local')=='sfx'):
|
170 |
app = set_scheme_middleware(app)
|
167 |
app = set_scheme_middleware(app)
|
171 |
# Redirect some status codes to /error/document
|
168 |
# "task" wsgi would get a 2nd request to /error/document if we used this middleware
|
172 |
if config.get('override_root') != 'task':
|
169 |
if config.get('override_root') != 'task':
|
173 |
# "task" wsgi would get a 2nd request to /error/document if we used this middleware
|
170 |
# Converts exceptions to HTTP errors, shows traceback in debug mode
|
|
|
171 |
tg.error.footer_html = '<!-- %s %s -->' # don't use TG footer with extra CSS & images that take time to load
|
|
|
172 |
app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
|
|
|
173 |
# Redirect some status codes to /error/document
|
174 |
if asbool(config['debug']):
|
174 |
if asbool(config['debug']):
|
175 |
app = StatusCodeRedirect(app, base_config.handle_status_codes)
|
175 |
app = StatusCodeRedirect(app, base_config.handle_status_codes)
|
176 |
else:
|
176 |
else:
|
177 |
app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
|
177 |
app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
|
178 |
return app
|
178 |
return app
|