2015-04-25 03:35:30 +08:00
|
|
|
"""
|
|
|
|
This module contains generic exceptions used by template backends. Although,
|
|
|
|
due to historical reasons, the Django template language also internally uses
|
|
|
|
these exceptions, other exceptions specific to the DTL should not be added
|
|
|
|
here.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class TemplateDoesNotExist(Exception):
|
|
|
|
"""
|
2017-01-25 04:36:36 +08:00
|
|
|
The exception used when a template does not exist. Optional arguments:
|
2015-04-25 03:35:30 +08:00
|
|
|
|
|
|
|
backend
|
|
|
|
The template backend class used when raising this exception.
|
|
|
|
|
|
|
|
tried
|
|
|
|
A list of sources that were tried when finding the template. This
|
|
|
|
is formatted as a list of tuples containing (origin, status), where
|
|
|
|
origin is an Origin object or duck type and status is a string with the
|
|
|
|
reason the template wasn't found.
|
|
|
|
|
|
|
|
chain
|
|
|
|
A list of intermediate TemplateDoesNotExist exceptions. This is used to
|
|
|
|
encapsulate multiple exceptions when loading templates from multiple
|
|
|
|
engines.
|
|
|
|
"""
|
2022-02-04 03:24:19 +08:00
|
|
|
|
2015-04-25 03:35:30 +08:00
|
|
|
def __init__(self, msg, tried=None, backend=None, chain=None):
|
|
|
|
self.backend = backend
|
|
|
|
if tried is None:
|
|
|
|
tried = []
|
|
|
|
self.tried = tried
|
|
|
|
if chain is None:
|
|
|
|
chain = []
|
|
|
|
self.chain = chain
|
2017-01-21 21:13:44 +08:00
|
|
|
super().__init__(msg)
|
2015-04-25 03:35:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
class TemplateSyntaxError(Exception):
|
|
|
|
"""
|
|
|
|
The exception used for syntax errors during parsing or rendering.
|
|
|
|
"""
|
2022-02-04 03:24:19 +08:00
|
|
|
|
2015-04-25 03:35:30 +08:00
|
|
|
pass
|