summaryrefslogtreecommitdiff
path: root/tests/test_client_regress
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-11-18 21:52:09 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-11-19 21:35:39 +0100
commitf88ad710faf0ebb53d96d6ab59f525c9aea4be41 (patch)
treebc10800d7a78962ffa7e120c93f1e4c199ac25a4 /tests/test_client_regress
parenta97e72aaabd1d065d49f909be20f0f3367a346d4 (diff)
downloaddjango-f88ad710faf0ebb53d96d6ab59f525c9aea4be41.tar.gz
Simplified caching of template context processors.
Diffstat (limited to 'tests/test_client_regress')
-rw-r--r--tests/test_client_regress/context_processors.py2
-rw-r--r--tests/test_client_regress/tests.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_client_regress/context_processors.py b/tests/test_client_regress/context_processors.py
new file mode 100644
index 0000000000..8c1e413881
--- /dev/null
+++ b/tests/test_client_regress/context_processors.py
@@ -0,0 +1,2 @@
+def special(request):
+ return {'path': request.special_path}
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index f7dcae15cf..63e60ee8bd 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -9,7 +9,6 @@ import itertools
from django.core.urlresolvers import reverse, NoReverseMatch
from django.template import TemplateSyntaxError, Context, Template
-import django.template.context
from django.test import Client, TestCase, override_settings
from django.test.client import encode_file, RequestFactory
from django.test.utils import ContextList, str_prefix
@@ -994,12 +993,11 @@ class ContextTests(TestCase):
# Need to insert a context processor that assumes certain things about
# the request instance. This triggers a bug caused by some ways of
# copying RequestContext.
- try:
- django.template.context._standard_context_processors = (lambda request: {'path': request.special_path},)
+ with self.settings(TEMPLATE_CONTEXT_PROCESSORS=(
+ 'test_client_regress.context_processors.special',
+ )):
response = self.client.get("/request_context_view/")
self.assertContains(response, 'Path: /request_context_view/')
- finally:
- django.template.context._standard_context_processors = None
def test_nested_requests(self):
"""