MCPcopy
hub / github.com/django/django / Engine

Class Engine

django/template/engine.py:13–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class Engine:
14 default_builtins = [
15 "django.template.defaulttags",
16 "django.template.defaultfilters",
17 "django.template.loader_tags",
18 ]
19
20 def __init__(
21 self,
22 dirs=None,
23 app_dirs=False,
24 context_processors=None,
25 debug=False,
26 loaders=None,
27 string_if_invalid="",
28 file_charset="utf-8",
29 libraries=None,
30 builtins=None,
31 autoescape=True,
32 ):
33 if dirs is None:
34 dirs = []
35 if context_processors is None:
36 context_processors = []
37 if loaders is None:
38 loaders = ["django.template.loaders.filesystem.Loader"]
39 if app_dirs:
40 loaders += ["django.template.loaders.app_directories.Loader"]
41 loaders = [("django.template.loaders.cached.Loader", loaders)]
42 else:
43 if app_dirs:
44 raise ImproperlyConfigured(
45 "app_dirs must not be set when loaders is defined."
46 )
47 if libraries is None:
48 libraries = {}
49 if builtins is None:
50 builtins = []
51
52 self.dirs = dirs
53 self.app_dirs = app_dirs
54 self.autoescape = autoescape
55 self.context_processors = context_processors
56 self.debug = debug
57 self.loaders = loaders
58 self.string_if_invalid = string_if_invalid
59 self.file_charset = file_charset
60 self.libraries = libraries
61 self.template_libraries = self.get_template_libraries(libraries)
62 self.builtins = self.default_builtins + builtins
63 self.template_builtins = self.get_template_builtins(self.builtins)
64
65 def __repr__(self):
66 return (
67 "<%s:%s app_dirs=%s%s debug=%s loaders=%s string_if_invalid=%s "
68 "file_charset=%s%s%s autoescape=%s>"
69 ) % (
70 self.__class__.__qualname__,

Callers 15

handleMethod · 0.90
render_to_responseMethod · 0.90
csrf_failureFunction · 0.90
debug.pyFile · 0.90
directory_indexFunction · 0.90
page_not_foundFunction · 0.90
__init__Method · 0.90
setUpMethod · 0.90
setUpClassMethod · 0.90
test_loaders_dirsMethod · 0.90

Calls

no outgoing calls

Tested by 15

setUpMethod · 0.72
setUpClassMethod · 0.72
test_loaders_dirsMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
_engineMethod · 0.72
setUpClassMethod · 0.72
test_textnode_reprMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…