Skip to content

Commit 5523e4c

Browse files
committed
Removed private API find_template.
It wasn't documented and it wasn't used anywhere, except in a few tests that don't test it specifically and can be rewritten with get_template.
1 parent 4ea43ac commit 5523e4c

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

django/template/loader.py

-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ def reload(self):
1717
return self.loader(self.loadname, self.dirs)[0]
1818

1919

20-
def find_template(*args, **kwargs):
21-
return Engine.get_default().find_template(*args, **kwargs)
22-
23-
2420
def get_template(template_name, dirs=_dirs_undefined, using=None):
2521
"""
2622
Loads and returns a template for the given name.

docs/releases/1.8.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ Cleanup of the ``django.template`` namespace
838838
If you've been relying on private APIs exposed in the ``django.template``
839839
module, you may have to import them from ``django.template.base`` instead.
840840

841-
Also ``django.template.base.compile_string()`` was removed.
841+
Also private APIs ``django.template.base.compile_string()`` and
842+
``django.template.loader.find_template()`` were removed.
842843

843844
Miscellaneous
844845
~~~~~~~~~~~~~

tests/template_tests/test_loaders.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ def test_not_installed(self):
114114
class CachedLoader(SimpleTestCase):
115115
def test_templatedir_caching(self):
116116
"Check that the template directories form part of the template cache key. Refs #13573"
117+
template_loader = Engine.get_default().template_loaders[0]
118+
117119
# Retrieve a template specifying a template directory to check
118-
t1, name = loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'first'),))
120+
t1, name = template_loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'first'),))
119121
# Now retrieve the same template name, but from a different directory
120-
t2, name = loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'second'),))
122+
t2, name = template_loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'second'),))
121123

122124
# The two templates should not have the same content
123125
self.assertNotEqual(t1.render(Context({})), t2.render(Context({})))
@@ -215,7 +217,7 @@ def test_basic(self):
215217
"""
216218
Check that the order of template loader works. Refs #21460.
217219
"""
218-
t1, name = loader.find_template('priority/foo.html')
220+
t1 = loader.get_template('priority/foo.html')
219221
self.assertEqual(t1.render(Context({})), 'priority\n')
220222

221223

@@ -228,5 +230,5 @@ def test_basic(self):
228230
"""
229231
Check that the order of template loader works. Refs #21460.
230232
"""
231-
t1, name = loader.find_template('priority/foo.html')
233+
t1 = loader.get_template('priority/foo.html')
232234
self.assertEqual(t1.render(Context({})), 'priority\n')

0 commit comments

Comments
 (0)