﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27258	Raise an exception if RequestContext is used with template.backends.django.Template.render()	Andi Albrecht	reficul31	"When using RequestContext with a Django template, the context_processors are not called to populate the context.

Here's an simple examle (see also attached test_request_context.py):

{{{
#!python
>>> from django.template.backends.django import DjangoTemplates
>>> from django.test import RequestFactory
>>> from django.template import Template, RequestContext
>>>
>>> # a simlpe context_processor:
>>> def test_processor_name(request):
...     return {'name': 'Hello World'}
>>>
>>> # Create a RequestContext
>>> request = RequestFactory().get('/')
>>> context = RequestContext(request, {}, [test_processor_name])
>>>
>>> # Base template (everything's fine)
>>> template = Template('{{ name }}')
>>> template.render(context)
<<< u'Hello World'
>>>
>>> # Django template :(
>>> engine = DjangoTemplates({
...             'DIRS': [],
...             'APP_DIRS': False,
...             'NAME': 'django',
...             'OPTIONS': {
...                 'context_processors': [test_processor_name],
...             },
...         })
>>> template = engine.from_string('{{ name }}')
>>> template.render(context)
<<< u''
}}}

The reason seems to be, that the `render()` method of a Django template (as opposed to the base template) calls `make_context` which wraps `RequestContext` in another `Context` instance. But when rendering the template the `bind_template` context manager only of the outermost `Context` instance is called, hence the context of a `RequestContext` instance is never populated by context_processors."	Cleanup/optimization	closed	Template system	1.10	Normal	fixed		Aymeric Augustin	Accepted	1	0	0	0	0	0
