mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -17,10 +17,6 @@ class LoaderOrigin(Origin): | |||||||
|         return self.loader(self.loadname, self.dirs)[0] |         return self.loader(self.loadname, self.dirs)[0] | ||||||
|  |  | ||||||
|  |  | ||||||
| def find_template(*args, **kwargs): |  | ||||||
|     return Engine.get_default().find_template(*args, **kwargs) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def get_template(template_name, dirs=_dirs_undefined, using=None): | def get_template(template_name, dirs=_dirs_undefined, using=None): | ||||||
|     """ |     """ | ||||||
|     Loads and returns a template for the given name. |     Loads and returns a template for the given name. | ||||||
|   | |||||||
| @@ -838,7 +838,8 @@ Cleanup of the ``django.template`` namespace | |||||||
| If you've been relying on private APIs exposed in the ``django.template`` | If you've been relying on private APIs exposed in the ``django.template`` | ||||||
| module, you may have to import them from ``django.template.base`` instead. | module, you may have to import them from ``django.template.base`` instead. | ||||||
|  |  | ||||||
| Also ``django.template.base.compile_string()`` was removed. | Also private APIs ``django.template.base.compile_string()`` and | ||||||
|  | ``django.template.loader.find_template()`` were removed. | ||||||
|  |  | ||||||
| Miscellaneous | Miscellaneous | ||||||
| ~~~~~~~~~~~~~ | ~~~~~~~~~~~~~ | ||||||
|   | |||||||
| @@ -114,10 +114,12 @@ class EggLoaderTest(SimpleTestCase): | |||||||
| class CachedLoader(SimpleTestCase): | class CachedLoader(SimpleTestCase): | ||||||
|     def test_templatedir_caching(self): |     def test_templatedir_caching(self): | ||||||
|         "Check that the template directories form part of the template cache key. Refs #13573" |         "Check that the template directories form part of the template cache key. Refs #13573" | ||||||
|  |         template_loader = Engine.get_default().template_loaders[0] | ||||||
|  |  | ||||||
|         # Retrieve a template specifying a template directory to check |         # Retrieve a template specifying a template directory to check | ||||||
|         t1, name = loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'first'),)) |         t1, name = template_loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'first'),)) | ||||||
|         # Now retrieve the same template name, but from a different directory |         # Now retrieve the same template name, but from a different directory | ||||||
|         t2, name = loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'second'),)) |         t2, name = template_loader.find_template('test.html', (os.path.join(os.path.dirname(upath(__file__)), 'templates', 'second'),)) | ||||||
|  |  | ||||||
|         # The two templates should not have the same content |         # The two templates should not have the same content | ||||||
|         self.assertNotEqual(t1.render(Context({})), t2.render(Context({}))) |         self.assertNotEqual(t1.render(Context({})), t2.render(Context({}))) | ||||||
| @@ -215,7 +217,7 @@ class PriorityCacheLoader(SimpleTestCase): | |||||||
|         """ |         """ | ||||||
|         Check that the order of template loader works. Refs #21460. |         Check that the order of template loader works. Refs #21460. | ||||||
|         """ |         """ | ||||||
|         t1, name = loader.find_template('priority/foo.html') |         t1 = loader.get_template('priority/foo.html') | ||||||
|         self.assertEqual(t1.render(Context({})), 'priority\n') |         self.assertEqual(t1.render(Context({})), 'priority\n') | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -228,5 +230,5 @@ class PriorityLoader(SimpleTestCase): | |||||||
|         """ |         """ | ||||||
|         Check that the order of template loader works. Refs #21460. |         Check that the order of template loader works. Refs #21460. | ||||||
|         """ |         """ | ||||||
|         t1, name = loader.find_template('priority/foo.html') |         t1 = loader.get_template('priority/foo.html') | ||||||
|         self.assertEqual(t1.render(Context({})), 'priority\n') |         self.assertEqual(t1.render(Context({})), 'priority\n') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user