misc: add global context variables to context processor (#26634)
This commit is contained in:
parent
8c3f17d2ed
commit
0f6acffbc8
|
@ -16,6 +16,11 @@
|
|||
|
||||
from quixote import get_publisher, get_response, get_request
|
||||
|
||||
def get_global_context():
|
||||
pub = get_publisher()
|
||||
if pub:
|
||||
return pub.substitutions.get_context_variables(mode='lazy')
|
||||
|
||||
def publisher(request):
|
||||
template_base = 'wcs/base.html'
|
||||
if request.path.startswith('/backoffice/'):
|
||||
|
@ -24,4 +29,5 @@ def publisher(request):
|
|||
'response': get_response,
|
||||
'user': lambda: get_request() and get_request().user,
|
||||
'template_base': template_base,
|
||||
'global_context': get_global_context,
|
||||
}
|
||||
|
|
|
@ -1032,7 +1032,7 @@ class QommonPublisher(Publisher, object):
|
|||
# possible modes:
|
||||
# * django-condition: used to evaluate django conditions
|
||||
# * python-condition: used to evaluate python conditions
|
||||
# * lazy: used to force lazy mode in tests
|
||||
# * lazy: used to force lazy mode in tests and in context processor
|
||||
modes = self.get_site_option('lazy-variables-modes')
|
||||
if modes:
|
||||
return [x.strip() for x in modes.split(',')]
|
||||
|
|
Loading…
Reference in New Issue