Loading django/template/base.py +2 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ from inspect import getargspec, getcallargs import warnings from django.apps import apps from django.conf import settings from django.template.context import (BaseContext, Context, RequestContext, # NOQA: imported for backwards compatibility ContextPopException) from django.utils import lru_cache Loading Loading @@ -126,11 +125,11 @@ class Template(object): except UnicodeDecodeError: raise TemplateEncodingError("Templates can only be constructed " "from unicode or UTF-8 strings.") if settings.TEMPLATE_DEBUG and origin is None: origin = StringOrigin(template_string) if engine is None: from .engine import Engine engine = Engine.get_default() if engine.debug and origin is None: origin = StringOrigin(template_string) self.nodelist = engine.compile_string(template_string, origin) self.name = name self.origin = origin Loading django/template/defaulttags.py +1 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ class ForNode(Node): context[self.loopvars[0]] = item # In TEMPLATE_DEBUG mode provide source of the node which # actually raised the exception if settings.TEMPLATE_DEBUG: if context.engine.debug: for node in self.nodelist_loop: try: nodelist.append(node.render(context)) Loading django/template/engine.py +5 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ class Engine(object): def __init__(self, dirs=None, app_dirs=False, allowed_include_roots=None, context_processors=None, loaders=None, string_if_invalid='', debug=False, loaders=None, string_if_invalid='', file_charset=None): if dirs is None: dirs = [] Loading @@ -42,6 +42,7 @@ class Engine(object): self.app_dirs = app_dirs self.allowed_include_roots = allowed_include_roots self.context_processors = context_processors self.debug = debug self.loaders = loaders self.string_if_invalid = string_if_invalid self.file_charset = file_charset Loading @@ -54,6 +55,7 @@ class Engine(object): dirs=settings.TEMPLATE_DIRS, allowed_include_roots=settings.ALLOWED_INCLUDE_ROOTS, context_processors=settings.TEMPLATE_CONTEXT_PROCESSORS, debug=settings.TEMPLATE_DEBUG, loaders=settings.TEMPLATE_LOADERS, string_if_invalid=settings.TEMPLATE_STRING_IF_INVALID, file_charset=settings.FILE_CHARSET, Loading Loading @@ -211,7 +213,7 @@ class Engine(object): """ Compiles template_string into a NodeList ready for rendering. """ if settings.TEMPLATE_DEBUG: if self.debug: from .debug import DebugLexer, DebugParser lexer_class, parser_class = DebugLexer, DebugParser else: Loading @@ -222,7 +224,7 @@ class Engine(object): return parser.parse() def make_origin(self, display_name, loader, name, dirs): if settings.TEMPLATE_DEBUG and display_name: if self.debug and display_name: # Inner import to avoid circular dependency from .loader import LoaderOrigin return LoaderOrigin(display_name, loader, name, dirs) Loading django/template/loader_tags.py +1 −2 Original line number Diff line number Diff line from collections import defaultdict from django.conf import settings from django.template.base import TemplateSyntaxError, Library, Node, TextNode,\ token_kwargs, Variable from django.template.loader import get_template Loading Loading @@ -154,7 +153,7 @@ class IncludeNode(Node): with context.push(**values): return template.render(context) except Exception: if settings.TEMPLATE_DEBUG: if context.engine.debug: raise return '' Loading django/test/signals.py +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ def reset_default_template_engine(**kwargs): 'TEMPLATE_DIRS', 'ALLOWED_INCLUDE_ROOTS', 'TEMPLATE_CONTEXT_PROCESSORS', 'TEMPLATE_DEBUG', 'TEMPLATE_LOADERS', 'TEMPLATE_STRING_IF_INVALID', 'FILE_CHARSET', Loading Loading
django/template/base.py +2 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ from inspect import getargspec, getcallargs import warnings from django.apps import apps from django.conf import settings from django.template.context import (BaseContext, Context, RequestContext, # NOQA: imported for backwards compatibility ContextPopException) from django.utils import lru_cache Loading Loading @@ -126,11 +125,11 @@ class Template(object): except UnicodeDecodeError: raise TemplateEncodingError("Templates can only be constructed " "from unicode or UTF-8 strings.") if settings.TEMPLATE_DEBUG and origin is None: origin = StringOrigin(template_string) if engine is None: from .engine import Engine engine = Engine.get_default() if engine.debug and origin is None: origin = StringOrigin(template_string) self.nodelist = engine.compile_string(template_string, origin) self.name = name self.origin = origin Loading
django/template/defaulttags.py +1 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ class ForNode(Node): context[self.loopvars[0]] = item # In TEMPLATE_DEBUG mode provide source of the node which # actually raised the exception if settings.TEMPLATE_DEBUG: if context.engine.debug: for node in self.nodelist_loop: try: nodelist.append(node.render(context)) Loading
django/template/engine.py +5 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ class Engine(object): def __init__(self, dirs=None, app_dirs=False, allowed_include_roots=None, context_processors=None, loaders=None, string_if_invalid='', debug=False, loaders=None, string_if_invalid='', file_charset=None): if dirs is None: dirs = [] Loading @@ -42,6 +42,7 @@ class Engine(object): self.app_dirs = app_dirs self.allowed_include_roots = allowed_include_roots self.context_processors = context_processors self.debug = debug self.loaders = loaders self.string_if_invalid = string_if_invalid self.file_charset = file_charset Loading @@ -54,6 +55,7 @@ class Engine(object): dirs=settings.TEMPLATE_DIRS, allowed_include_roots=settings.ALLOWED_INCLUDE_ROOTS, context_processors=settings.TEMPLATE_CONTEXT_PROCESSORS, debug=settings.TEMPLATE_DEBUG, loaders=settings.TEMPLATE_LOADERS, string_if_invalid=settings.TEMPLATE_STRING_IF_INVALID, file_charset=settings.FILE_CHARSET, Loading Loading @@ -211,7 +213,7 @@ class Engine(object): """ Compiles template_string into a NodeList ready for rendering. """ if settings.TEMPLATE_DEBUG: if self.debug: from .debug import DebugLexer, DebugParser lexer_class, parser_class = DebugLexer, DebugParser else: Loading @@ -222,7 +224,7 @@ class Engine(object): return parser.parse() def make_origin(self, display_name, loader, name, dirs): if settings.TEMPLATE_DEBUG and display_name: if self.debug and display_name: # Inner import to avoid circular dependency from .loader import LoaderOrigin return LoaderOrigin(display_name, loader, name, dirs) Loading
django/template/loader_tags.py +1 −2 Original line number Diff line number Diff line from collections import defaultdict from django.conf import settings from django.template.base import TemplateSyntaxError, Library, Node, TextNode,\ token_kwargs, Variable from django.template.loader import get_template Loading Loading @@ -154,7 +153,7 @@ class IncludeNode(Node): with context.push(**values): return template.render(context) except Exception: if settings.TEMPLATE_DEBUG: if context.engine.debug: raise return '' Loading
django/test/signals.py +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ def reset_default_template_engine(**kwargs): 'TEMPLATE_DIRS', 'ALLOWED_INCLUDE_ROOTS', 'TEMPLATE_CONTEXT_PROCESSORS', 'TEMPLATE_DEBUG', 'TEMPLATE_LOADERS', 'TEMPLATE_STRING_IF_INVALID', 'FILE_CHARSET', Loading