mirror of https://github.com/django/django.git
Fixed #7116 -- Optimize RequestContext construction
This commit is contained in:
parent
5cdacbda03
commit
8d473b2c54
|
@ -180,5 +180,7 @@ class RequestContext(Context):
|
|||
processors = ()
|
||||
else:
|
||||
processors = tuple(processors)
|
||||
updates = dict()
|
||||
for processor in get_standard_processors() + processors:
|
||||
self.update(processor(request))
|
||||
updates.update(processor(request))
|
||||
self.update(updates)
|
||||
|
|
|
@ -1843,3 +1843,12 @@ class RequestContextTests(unittest.TestCase):
|
|||
template.Template('{% include "child" only %}').render(ctx),
|
||||
'none'
|
||||
)
|
||||
|
||||
def test_stack_size(self):
|
||||
"""
|
||||
Regression test for #7116, Optimize RequetsContext construction
|
||||
"""
|
||||
ctx = RequestContext(self.fake_request, {})
|
||||
# The stack should now contain 3 items:
|
||||
# [builtins, supplied context, context processor]
|
||||
self.assertEqual(len(ctx.dicts), 3)
|
||||
|
|
Loading…
Reference in New Issue