diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-11-22 21:33:40 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-11-23 11:54:17 +0100 |
| commit | 6294bd3903e12507c4e70e012dade82d0f52c388 (patch) | |
| tree | 5756d5318c51ccd589d3a3c69a928843a72541e2 /django/template/engine.py | |
| parent | 47a131b9446eb9b31e57554f17310bc2fd43a26f (diff) | |
Encapsulated TEMPLATE_DEBUG in Engine.
Diffstat (limited to 'django/template/engine.py')
| -rw-r--r-- | django/template/engine.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/django/template/engine.py b/django/template/engine.py index ce497ad234..36991133f6 100644 --- a/django/template/engine.py +++ b/django/template/engine.py @@ -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 = [] @@ -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 @@ -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, @@ -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: @@ -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) |
