Regarding find_template_source()
I still find myself in need of getting a template source, the current find_template returns a compiled template for the most part, and I would suggest keeping a working find_template_source for these edge cases as mine. Perhaps something like this is in place:
def find_template_source(name, dirs=None):
if template_source_loaders is None:
loaders = []
for loader_name in settings.TEMPLATE_LOADERS:
loader = find_template_loader(loader_name)
if loader is not None:
loaders.append(loader)
template_source_loaders = tuple(loaders)
def load_template_source(loaders):
for loader in loaders:
if hasattr(loader, 'loaders'):
try:
return load_template_source(loader.loaders)
except TemplateDoesNotExist:
pass
else:
try:
source, display_name = loader.load_template_source(name, dirs)
return (source, make_origin(display_name, loader, name, dirs))
except TemplateDoesNotExist:
pass
raise TemplateDoesNotExist(name)
return load_template_source(template_source_loaders)
This looks very similar to #15102.