|
a/Allura/allura/config/middleware.py |
|
b/Allura/allura/config/middleware.py |
|
... |
|
... |
73 |
app = StatsMiddleware(app, stats_config)
|
73 |
app = StatsMiddleware(app, stats_config)
|
74 |
|
74 |
|
75 |
if asbool(app_conf.get('auth.method', 'local')=='sfx'):
|
75 |
if asbool(app_conf.get('auth.method', 'local')=='sfx'):
|
76 |
app = SSLMiddleware(app, app_conf.get('no_redirect.pattern'))
|
76 |
app = SSLMiddleware(app, app_conf.get('no_redirect.pattern'))
|
77 |
|
77 |
|
78 |
app = ew.ResourceMiddleware(
|
78 |
app = ew.WidgetMiddleware(
|
79 |
app,
|
79 |
app,
|
80 |
compress=not asbool(global_conf['debug']),
|
80 |
compress=not asbool(global_conf['debug']),
|
81 |
# compress=True,
|
81 |
# compress=True,
|
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 |
|
85 |
|
85 |
app = StaticFilesMiddleware(app, app_conf.get('static.script_name'))
|
86 |
app = StaticFilesMiddleware(app, app_conf.get('static.script_name'))
|
86 |
|
87 |
|
87 |
return app
|
88 |
return app
|
88 |
|
89 |
|
89 |
|
90 |
|
|
|
91 |
def get_tg_vars(context):
|
|
|
92 |
import pylons, tg
|
|
|
93 |
from allura.lib import helpers as h
|
|
|
94 |
from urllib import quote_plus
|
|
|
95 |
context.setdefault('g', pylons.g)
|
|
|
96 |
context.setdefault('c', pylons.c)
|
|
|
97 |
context.setdefault('h', h)
|
|
|
98 |
context.setdefault('request', pylons.request)
|
|
|
99 |
context.setdefault('response', pylons.response)
|
|
|
100 |
context.setdefault('url', pylons.url)
|
|
|
101 |
context.setdefault('tg', dict(
|
|
|
102 |
config=tg.config,
|
|
|
103 |
flash_obj=tg.flash,
|
|
|
104 |
quote_plus=quote_plus,
|
|
|
105 |
url=tg.url))
|