diff --git a/django/views/debug.py b/django/views/debug.py index 21e7f72e6b..6bb6a0bd93 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -91,16 +91,18 @@ class ExceptionReporter: module = import_module(loader.__module__) if hasattr(loader, '__class__'): source_list_func = loader.get_template_sources - loader_name = loader.__module__ + '.' + loader.__class__.__name__ else: # NOTE: Remember to remove this branch when we deprecate old template loaders in 1.4 source_list_func = module.get_template_sources - loader_name = loader.__module__ + '.' + loader.__name__ # NOTE: This assumes exc_value is the name of the template that # the loader attempted to load. template_list = [{'name': t, 'exists': os.path.exists(t)} \ for t in source_list_func(str(self.exc_value))] except (ImportError, AttributeError): template_list = [] + if hasattr(loader, '__class__'): + loader_name = loader.__module__ + '.' + loader.__class__.__name__ + else: # NOTE: Remember to remove this branch when we deprecate old template loaders in 1.4 + loader_name = loader.__module__ + '.' + loader.__name__ self.loader_debug_info.append({ 'loader': loader_name, 'templates': template_list,