diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-11-22 09:22:38 +0100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-11-22 17:58:38 +0100 |
commit | 733178830072caeca3c054a220808b4c557faec4 (patch) | |
tree | 74d0eeee1edc9f2861aea82599ab6bc63cbcd2c2 /tests/context_processors | |
parent | bf1bd0fbc9d4920327ad998ad11facf842492e23 (diff) | |
download | django-733178830072caeca3c054a220808b4c557faec4.tar.gz |
Avoided rewrapping Contexts in render_to_response.
This change preserves backwards-compatibility for a very common misuse
of render_to_response which even occurred in the official documentation.
It fixes that misuse wherever it happened in the code base and docs.
Context.__init__ is documented as accepting a dict and nothing else.
Since Context is dict-like, Context(Context({})) could work to some
extent. However, things get complicated with RequestContext and that
gets in the way of refactoring the template engine. This is the real
rationale for this change.
Diffstat (limited to 'tests/context_processors')
-rw-r--r-- | tests/context_processors/views.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/context_processors/views.py b/tests/context_processors/views.py index 7a00edab0a..077d722750 100644 --- a/tests/context_processors/views.py +++ b/tests/context_processors/views.py @@ -8,12 +8,13 @@ from .models import DebugObject def request_processor(request): return render_to_response( 'context_processors/request_attrs.html', - RequestContext(request, {}, processors=[context_processors.request])) + context_instance=RequestContext(request, {}, processors=[context_processors.request])) def debug_processor(request): + return render_to_response( 'context_processors/debug.html', - RequestContext(request, { + context_instance=RequestContext(request, { 'debug_objects': DebugObject.objects, }, processors=[context_processors.debug])) |