From ed220c4cbea04c2e77535af93bcfaa917cce607a Mon Sep 17 00:00:00 2001 From: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon, 29 Dec 2014 23:51:25 +0100 Subject: [PATCH] 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. --- django/template/engine.py | 12 ++++++------ django/template/loader.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/django/template/engine.py b/django/template/engine.py index 9fecabb259..9e9feb70fa 100644 --- a/django/template/engine.py +++ b/django/template/engine.py @@ -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: diff --git a/django/template/loader.py b/django/template/loader.py index 0bc64e4d7d..d93b5e6b2b 100644 --- a/django/template/loader.py +++ b/django/template/loader.py @@ -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(