Skip to content

Commit cf717de

Browse files
committed
HUE-8905 [core] Apply HUE-8772 to Django-1.11.22 for fixing 'user is missing in mako context'
1 parent 4010e21 commit cf717de

File tree

1 file changed

+27
-2
lines changed
  • desktop/core/ext-py/Django-1.11.22/django/template

1 file changed

+27
-2
lines changed

desktop/core/ext-py/Django-1.11.22/django/template/context.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,25 @@ def push_state(self, template, isolated_context=True):
228228
self.pop()
229229

230230

231+
from django.utils.module_loading import import_string
232+
_standard_context_processors = None
233+
234+
# This is a function rather than module-level procedural code because we only
235+
# want it to execute if somebody uses RequestContext.
236+
def get_standard_processors():
237+
from django.conf import settings
238+
global _standard_context_processors
239+
if _standard_context_processors is None:
240+
processors = []
241+
collect = []
242+
collect.extend(_builtin_context_processors)
243+
collect.extend(settings.GTEMPLATE_CONTEXT_PROCESSORS)
244+
for path in collect:
245+
func = import_string(path)
246+
processors.append(func)
247+
_standard_context_processors = tuple(processors)
248+
return _standard_context_processors
249+
231250
class RequestContext(Context):
232251
"""
233252
This subclass of template.Context automatically populates itself using
@@ -242,12 +261,18 @@ def __init__(self, request, dict_=None, processors=None, use_l10n=None, use_tz=N
242261
self._processors = () if processors is None else tuple(processors)
243262
self._processors_index = len(self.dicts)
244263

264+
updates = dict()
265+
#@TODO@ Prakash to Implement context processor
266+
for processor in get_standard_processors():
267+
updates.update(processor(request))
268+
self.update(updates)
269+
245270
# placeholder for context processors output
246-
self.update({})
271+
#self.update({})
247272

248273
# empty dict for any new modifications
249274
# (so that context processors don't overwrite them)
250-
self.update({})
275+
#self.update({})
251276

252277
@contextmanager
253278
def bind_template(self, template):

0 commit comments

Comments
 (0)