Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #7116 -- Optimize RequestContext construction

  • Loading branch information...
commit 8d473b2c54035cbcd3aacef0cb83a9769cd05ad3 1 parent 5cdacbd
@funkybob funkybob authored akaariai committed
Showing with 12 additions and 1 deletion.
  1. +3 −1 django/template/context.py
  2. +9 −0 tests/template_tests/tests.py
View
4 django/template/context.py
@@ -180,5 +180,7 @@ def __init__(self, request, dict_=None, processors=None, current_app=None,
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)
View
9 tests/template_tests/tests.py
@@ -1843,3 +1843,12 @@ def test_include_only(self):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.