MCPcopy Index your code
hub / github.com/nodejs/node / get_template

Method get_template

tools/inspector_protocol/jinja2/environment.py:810–830  ·  view source on GitHub ↗

Load a template from the loader. If a loader is configured this method asks the loader for the template and returns a :class:`Template`. If the `parent` parameter is not `None`, :meth:`join_path` is called to get the real template name before loading. The `globals`

(self, name, parent=None, globals=None)

Source from the content-addressed store, hash-verified

808
809 @internalcode
810 def get_template(self, name, parent=None, globals=None):
811 """Load a template from the loader. If a loader is configured this
812 method asks the loader for the template and returns a :class:`Template`.
813 If the `parent` parameter is not `None`, :meth:`join_path` is called
814 to get the real template name before loading.
815
816 The `globals` parameter can be used to provide template wide globals.
817 These variables are available in the context at render time.
818
819 If the template does not exist a :exc:`TemplateNotFound` exception is
820 raised.
821
822 .. versionchanged:: 2.4
823 If `name` is a :class:`Template` object it is returned from the
824 function unchanged.
825 """
826 if isinstance(name, Template):
827 return name
828 if parent is not None:
829 name = self.join_path(name, parent)
830 return self._load_template(name, self.make_globals(globals))
831
832 @internalcode
833 def select_template(self, names, parent=None, globals=None):

Callers 1

Calls 3

join_pathMethod · 0.95
_load_templateMethod · 0.95
make_globalsMethod · 0.95

Tested by

no test coverage detected