summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-11-15 19:55:53 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-11-16 21:41:42 +0100
commit1851dcf377d05a5d167cf482674e4c4a4e2502a5 (patch)
tree8eb977a5a3fe325cc2d6a2d064153ed7dc9ebb26
parent0bf99193f88238aea0a12970503a7b5dceb206ec (diff)
Deprecated function-based loaders.
-rw-r--r--django/template/loader.py6
-rw-r--r--docs/internals/deprecation.txt2
-rw-r--r--docs/releases/1.8.txt7
3 files changed, 15 insertions, 0 deletions
diff --git a/django/template/loader.py b/django/template/loader.py
index 3fe4773894..c62c383322 100644
--- a/django/template/loader.py
+++ b/django/template/loader.py
@@ -37,6 +37,12 @@ def find_template_loader(loader):
if hasattr(TemplateLoader, 'load_template_source'):
func = TemplateLoader(*args)
else:
+ warnings.warn(
+ "Function-based template loaders are deprecated. Please use "
+ "class-based template loaders instead. Inherit base.Loader "
+ "and provide a load_template_source() method.",
+ RemovedInDjango20Warning, stacklevel=2)
+
# Try loading module the old way - string is full path to callable
if args:
raise ImproperlyConfigured(
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 666ff1f492..7247e4a2aa 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -85,6 +85,8 @@ details on these changes.
* The backwards compatibility alias ``django.template.loader.BaseLoader`` will
be removed.
+* Support for function-based template loaders will be removed.
+
.. _deprecation-removed-in-1.9:
1.9
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 73c0e7a040..d55ed1820d 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -1040,6 +1040,13 @@ class decorators. As a consequence, when overriding ``setUpClass()`` or
``django.template.loaders.base.Loader``. If you've written a custom template
loader that inherits ``BaseLoader``, you must inherit ``Loader`` instead.
+Function-based template loaders
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In addition to the documented class-based API for custom template loaders,
+Django still supported to some extent an earlier function-based API. This
+private API wasn't maintained or tested. Now it's formally deprecated.
+
``django.test.utils.TestTemplateLoader``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~