Added comments to remove Engine.render_to_string in Django 2.0.

Since this is a private API introduced in Django 1.8, no documentation
is required.
This commit is contained in:
Aymeric Augustin 2014-12-29 23:51:25 +01:00
parent 2e65d56156
commit ed220c4cbe
2 changed files with 9 additions and 9 deletions

View File

@ -171,16 +171,16 @@ class Engine(object):
template = Template(template, origin, template_name, engine=self)
return template
# This method was originally a function defined in django.template.loader.
# It was moved here in Django 1.8 when encapsulating the Django template
# engine in this Engine class. It's still called by deprecated code but it
# will be removed in Django 2.0. It's superseded by a new render_to_string
# function in django.template.loader.
def render_to_string(self, template_name, context=None,
context_instance=_context_instance_undefined,
dirs=_dirs_undefined,
dictionary=_dictionary_undefined):
"""
Loads the given template_name and renders it with the given dictionary as
context. The template_name may be a string to load a single template using
get_template, or it may be a tuple to use select_template to find one of
the templates in the list. Returns a string.
"""
if context_instance is _context_instance_undefined:
context_instance = None
else:

View File

@ -100,9 +100,9 @@ def render_to_string(template_name, context=None,
# Some deprecated arguments were passed - use the legacy code path
for engine in _engine_list(using):
try:
# This is required for deprecating arguments specific to Django
# templates. Simply return engine.render_to_string(template_name,
# context) in Django 2.0.
# This is required for deprecating properly arguments specific
# to Django templates. Remove Engine.render_to_string() at the
# same time as this code path in Django 2.0.
if isinstance(engine, DjangoTemplates):
# Hack -- use the internal Engine instance of DjangoTemplates.
return engine.engine.render_to_string(