MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/template/base.py:142–157  ·  view source on GitHub ↗
(self, template_string, origin=None, name=None, engine=None)

Source from the content-addressed store, hash-verified

140
141class Template:
142 def __init__(self, template_string, origin=None, name=None, engine=None):
143 # If Template is instantiated directly rather than from an Engine and
144 # exactly one Django template engine is configured, use that engine.
145 # This is required to preserve backwards-compatibility for direct use
146 # e.g. Template('...').render(Context({...}))
147 if engine is None:
148 from .engine import Engine
149
150 engine = Engine.get_default()
151 if origin is None:
152 origin = Origin(UNKNOWN_SOURCE)
153 self.name = name
154 self.origin = origin
155 self.engine = engine
156 self.source = str(template_string) # May be lazy.
157 self.nodelist = self.compile_nodelist()
158
159 def __repr__(self):
160 return '<%s template_string="%s...">' % (

Callers

nothing calls this directly

Calls 3

compile_nodelistMethod · 0.95
OriginClass · 0.70
get_defaultMethod · 0.45

Tested by

no test coverage detected