|
a/Allura/allura/config/middleware.py |
|
b/Allura/allura/config/middleware.py |
|
... |
|
... |
82 |
script_name=app_conf.get('ew.script_name', '/_ew_resources/'),
|
82 |
script_name=app_conf.get('ew.script_name', '/_ew_resources/'),
|
83 |
url_base=app_conf.get('ew.url_base', '/_ew_resources/'))
|
83 |
url_base=app_conf.get('ew.url_base', '/_ew_resources/'))
|
84 |
ew.render.TemplateEngine.register_variable_provider(get_tg_vars)
|
84 |
ew.render.TemplateEngine.register_variable_provider(get_tg_vars)
|
85 |
|
85 |
|
86 |
app = StaticFilesMiddleware(app, app_conf.get('static.script_name'))
|
86 |
app = StaticFilesMiddleware(app, app_conf.get('static.script_name'))
|
|
|
87 |
app = set_scheme_middleware(app)
|
87 |
|
88 |
|
88 |
return app
|
89 |
return app
|
89 |
|
90 |
|
|
|
91 |
def set_scheme_middleware(app):
|
|
|
92 |
def SchemeMiddleware(environ, start_response):
|
|
|
93 |
if asbool(environ.get('HTTP_X_SFINC_SSL', 'false')):
|
|
|
94 |
environ['wsgi.url_scheme'] = 'https'
|
|
|
95 |
return app(environ, start_response)
|
|
|
96 |
return SchemeMiddleware
|
90 |
|
97 |
|
91 |
def get_tg_vars(context):
|
98 |
def get_tg_vars(context):
|
92 |
import pylons, tg
|
99 |
import pylons, tg
|
93 |
from allura.lib import helpers as h
|
100 |
from allura.lib import helpers as h
|
94 |
from urllib import quote_plus
|
101 |
from urllib import quote_plus
|