Mercurial > piecrust2
comparison piecrust/templating/base.py @ 128:28444014ce7d
Fix error reporting and counting of lines.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 14 Nov 2014 22:49:50 +0100 |
parents | f485ba500df3 |
children | 96d363e2da4b |
comparison
equal
deleted
inserted
replaced
127:bc63dc20baa0 | 128:28444014ce7d |
---|---|
1 | 1 |
2 | 2 |
3 class TemplateNotFoundError(Exception): | 3 class TemplateNotFoundError(Exception): |
4 pass | 4 pass |
5 | |
6 | |
7 class TemplatingError(Exception): | |
8 def __init__(self, message, filename=None, lineno=-1): | |
9 super(TemplatingError, self).__init__() | |
10 self.message = message | |
11 self.filename = filename | |
12 self.lineno = lineno | |
13 | |
14 def __str__(self): | |
15 msg = '' | |
16 if self.filename: | |
17 msg += self.filename | |
18 if self.lineno >= 0: | |
19 msg += ', line %d' % self.lineno | |
20 msg += ': ' + self.message | |
21 return msg | |
5 | 22 |
6 | 23 |
7 class TemplateEngine(object): | 24 class TemplateEngine(object): |
8 EXTENSIONS = [] | 25 EXTENSIONS = [] |
9 | 26 |