Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/django/template/exceptions.py: 40%

12 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1""" 

2This module contains generic exceptions used by template backends. Although, 

3due to historical reasons, the Django template language also internally uses 

4these exceptions, other exceptions specific to the DTL should not be added 

5here. 

6""" 

7 

8 

9class TemplateDoesNotExist(Exception): 

10 """ 

11 The exception used when a template does not exist. Optional arguments: 

12 

13 backend 

14 The template backend class used when raising this exception. 

15 

16 tried 

17 A list of sources that were tried when finding the template. This 

18 is formatted as a list of tuples containing (origin, status), where 

19 origin is an Origin object or duck type and status is a string with the 

20 reason the template wasn't found. 

21 

22 chain 

23 A list of intermediate TemplateDoesNotExist exceptions. This is used to 

24 encapsulate multiple exceptions when loading templates from multiple 

25 engines. 

26 """ 

27 

28 def __init__(self, msg, tried=None, backend=None, chain=None): 

29 self.backend = backend 

30 if tried is None: 

31 tried = [] 

32 self.tried = tried 

33 if chain is None: 

34 chain = [] 

35 self.chain = chain 

36 super().__init__(msg) 

37 

38 

39class TemplateSyntaxError(Exception): 

40 """ 

41 The exception used for syntax errors during parsing or rendering. 

42 """ 

43 

44 pass