Refs #25791 -- Added get_dirs() method to cached template loader.
This commit is contained in:
parent
859cd7c6b4
commit
29845ecf69
|
@ -18,6 +18,11 @@ class Loader(BaseLoader):
|
|||
self.loaders = engine.get_template_loaders(loaders)
|
||||
super().__init__(engine)
|
||||
|
||||
def get_dirs(self):
|
||||
for loader in self.loaders:
|
||||
if hasattr(loader, "get_dirs"):
|
||||
yield from loader.get_dirs()
|
||||
|
||||
def get_contents(self, origin):
|
||||
return origin.loader.get_contents(origin)
|
||||
|
||||
|
|
|
@ -93,6 +93,10 @@ class CachedLoaderTests(SimpleTestCase):
|
|||
"""
|
||||
self.assertEqual(self.engine.template_loaders[0].cache_key(lazystr('template.html'), []), 'template.html')
|
||||
|
||||
def test_get_dirs(self):
|
||||
inner_dirs = self.engine.template_loaders[0].loaders[0].get_dirs()
|
||||
self.assertSequenceEqual(list(self.engine.template_loaders[0].get_dirs()), list(inner_dirs))
|
||||
|
||||
|
||||
class FileSystemLoaderTests(SimpleTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue