MCPcopy
hub / github.com/pallets/jinja / TemplateNotFound

Class TemplateNotFound

src/jinja2/exceptions.py:18–50  ·  view source on GitHub ↗

Raised if a template does not exist. .. versionchanged:: 2.11 If the given name is :class:`Undefined` and no message was provided, an :exc:`UndefinedError` is raised.

Source from the content-addressed store, hash-verified

16
17
18class TemplateNotFound(IOError, LookupError, TemplateError):
19 """Raised if a template does not exist.
20
21 .. versionchanged:: 2.11
22 If the given name is :class:`Undefined` and no message was
23 provided, an :exc:`UndefinedError` is raised.
24 """
25
26 # Silence the Python warning about message being deprecated since
27 # it's not valid here.
28 message: t.Optional[str] = None
29
30 def __init__(
31 self,
32 name: t.Optional[t.Union[str, "Undefined"]],
33 message: t.Optional[str] = None,
34 ) -> None:
35 IOError.__init__(self, name)
36
37 if message is None:
38 from .runtime import Undefined
39
40 if isinstance(name, Undefined):
41 name._fail_with_undefined_error()
42
43 message = name
44
45 self.message = message
46 self.name = name
47 self.templates = [name]
48
49 def __str__(self) -> str:
50 return str(self.message)
51
52
53class TemplatesNotFound(TemplateNotFound):

Callers 12

split_template_pathFunction · 0.85
get_sourceMethod · 0.85
get_sourceMethod · 0.85
get_sourceMethod · 0.85
get_sourceMethod · 0.85
get_sourceMethod · 0.85
get_loaderMethod · 0.85
get_sourceMethod · 0.85
loadMethod · 0.85
get_sourceMethod · 0.85
loadMethod · 0.85
loadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected