Loading django/contrib/admin/sites.py +2 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from django.db.models.base import ModelBase from django.apps import apps from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.urlresolvers import reverse, NoReverseMatch from django.template.engine import Engine from django.template.response import TemplateResponse from django.utils import six from django.utils.text import capfirst Loading Loading @@ -170,7 +171,7 @@ class AdminSite(object): if not apps.is_installed('django.contrib.contenttypes'): raise ImproperlyConfigured("Put 'django.contrib.contenttypes' in " "your INSTALLED_APPS setting in order to use the admin application.") if 'django.contrib.auth.context_processors.auth' not in settings.TEMPLATE_CONTEXT_PROCESSORS: if 'django.contrib.auth.context_processors.auth' not in Engine.get_default().context_processors: raise ImproperlyConfigured("Put 'django.contrib.auth.context_processors.auth' " "in your TEMPLATE_CONTEXT_PROCESSORS setting in order to use the admin application.") Loading django/contrib/admindocs/views.py +3 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ from django.core.exceptions import ViewDoesNotExist from django.http import Http404 from django.core import urlresolvers from django.contrib.admindocs import utils from django.template.engine import Engine from django.utils.decorators import method_decorator from django.utils._os import upath from django.utils import six Loading Loading @@ -291,13 +292,13 @@ class TemplateDetailView(BaseAdminDocsView): def get_context_data(self, **kwargs): template = self.kwargs['template'] templates = [] for dir in settings.TEMPLATE_DIRS: for dir in Engine.get_default().dirs: template_file = os.path.join(dir, template) templates.append({ 'file': template_file, 'exists': os.path.exists(template_file), 'contents': lambda: open(template_file).read() if os.path.exists(template_file) else '', 'order': list(settings.TEMPLATE_DIRS).index(dir), 'order': list(Engine.get_default().dirs).index(dir), }) kwargs.update({ 'name': template, Loading django/views/debug.py +5 −3 Original line number Diff line number Diff line Loading @@ -276,14 +276,16 @@ class ExceptionReporter(object): def get_traceback_data(self): """Return a dictionary containing traceback information.""" # TODO: handle multiple template engines. template_engine = Engine.get_default() if self.exc_type and issubclass(self.exc_type, TemplateDoesNotExist): self.template_does_not_exist = True self.loader_debug_info = [] # If Django fails in get_template_loaders, provide an empty list # for the following loop to not fail. try: # TODO: handle multiple template engines. template_loaders = Engine.get_default().template_loaders template_loaders = template_engine.template_loaders except Exception: template_loaders = [] for loader in template_loaders: Loading @@ -302,7 +304,7 @@ class ExceptionReporter(object): 'loader': loader_name, 'templates': template_list, }) if (settings.TEMPLATE_DEBUG and if (template_engine.debug and hasattr(self.exc_value, 'django_template_source')): self.get_template_exception_info() Loading Loading
django/contrib/admin/sites.py +2 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from django.db.models.base import ModelBase from django.apps import apps from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.urlresolvers import reverse, NoReverseMatch from django.template.engine import Engine from django.template.response import TemplateResponse from django.utils import six from django.utils.text import capfirst Loading Loading @@ -170,7 +171,7 @@ class AdminSite(object): if not apps.is_installed('django.contrib.contenttypes'): raise ImproperlyConfigured("Put 'django.contrib.contenttypes' in " "your INSTALLED_APPS setting in order to use the admin application.") if 'django.contrib.auth.context_processors.auth' not in settings.TEMPLATE_CONTEXT_PROCESSORS: if 'django.contrib.auth.context_processors.auth' not in Engine.get_default().context_processors: raise ImproperlyConfigured("Put 'django.contrib.auth.context_processors.auth' " "in your TEMPLATE_CONTEXT_PROCESSORS setting in order to use the admin application.") Loading
django/contrib/admindocs/views.py +3 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ from django.core.exceptions import ViewDoesNotExist from django.http import Http404 from django.core import urlresolvers from django.contrib.admindocs import utils from django.template.engine import Engine from django.utils.decorators import method_decorator from django.utils._os import upath from django.utils import six Loading Loading @@ -291,13 +292,13 @@ class TemplateDetailView(BaseAdminDocsView): def get_context_data(self, **kwargs): template = self.kwargs['template'] templates = [] for dir in settings.TEMPLATE_DIRS: for dir in Engine.get_default().dirs: template_file = os.path.join(dir, template) templates.append({ 'file': template_file, 'exists': os.path.exists(template_file), 'contents': lambda: open(template_file).read() if os.path.exists(template_file) else '', 'order': list(settings.TEMPLATE_DIRS).index(dir), 'order': list(Engine.get_default().dirs).index(dir), }) kwargs.update({ 'name': template, Loading
django/views/debug.py +5 −3 Original line number Diff line number Diff line Loading @@ -276,14 +276,16 @@ class ExceptionReporter(object): def get_traceback_data(self): """Return a dictionary containing traceback information.""" # TODO: handle multiple template engines. template_engine = Engine.get_default() if self.exc_type and issubclass(self.exc_type, TemplateDoesNotExist): self.template_does_not_exist = True self.loader_debug_info = [] # If Django fails in get_template_loaders, provide an empty list # for the following loop to not fail. try: # TODO: handle multiple template engines. template_loaders = Engine.get_default().template_loaders template_loaders = template_engine.template_loaders except Exception: template_loaders = [] for loader in template_loaders: Loading @@ -302,7 +304,7 @@ class ExceptionReporter(object): 'loader': loader_name, 'templates': template_list, }) if (settings.TEMPLATE_DEBUG and if (template_engine.debug and hasattr(self.exc_value, 'django_template_source')): self.get_template_exception_info() Loading