##// END OF EJS Templates
pyramid: Fix problem with adding '_' to renderer globals....
johbo -
r21:91f51a05 default
parent child Browse files
Show More
@@ -21,6 +21,7 b''
21
21
22 import pylons
22 import pylons
23 from pyramid.i18n import get_localizer, TranslationStringFactory
23 from pyramid.i18n import get_localizer, TranslationStringFactory
24 from pyramid.threadlocal import get_current_request
24
25
25 tsf = TranslationStringFactory('rc_root')
26 tsf = TranslationStringFactory('rc_root')
26
27
@@ -33,8 +34,11 b' def add_renderer_globals(event):'
33 event['c'] = pylons.tmpl_context
34 event['c'] = pylons.tmpl_context
34 event['url'] = pylons.url
35 event['url'] = pylons.url
35
36
37 # TODO: When executed in pyramid view context the request is not available
38 # in the event. Find a better solution to get the request.
39 request = event['request'] or get_current_request()
40
36 # Add Pyramid translation as '_' to context
41 # Add Pyramid translation as '_' to context
37 request = event['request']
38 event['_'] = request.translate
42 event['_'] = request.translate
39 event['localizer'] = request.localizer
43 event['localizer'] = request.localizer
40
44
General Comments 0
You need to be logged in to leave comments. Login now