diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2009-02-24 22:58:00 +0100 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2009-02-24 22:58:00 +0100 |
commit | d416a97260947fcd302f2e14e28cb6160dd412ab (patch) | |
tree | c673bf982daeb646465bb000d938f86bf052f2d0 /jinja2/exceptions.py | |
parent | 1d021082f61dbad8ba64181b743cd29da514dfff (diff) | |
download | jinja2-d416a97260947fcd302f2e14e28cb6160dd412ab.tar.gz |
Improved Jinja's debugging support by introducing "@internalcode" which marks code objects that are skipped on tracebacks. Also template errors are now translated as well to help the pylons debugger.
--HG--
branch : trunk
Diffstat (limited to 'jinja2/exceptions.py')
-rw-r--r-- | jinja2/exceptions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jinja2/exceptions.py b/jinja2/exceptions.py index 8311cf3..182c061 100644 --- a/jinja2/exceptions.py +++ b/jinja2/exceptions.py @@ -44,7 +44,16 @@ class TemplateSyntaxError(TemplateError): self.filename = filename self.source = None + # this is set to True if the debug.translate_syntax_error + # function translated the syntax error into a new traceback + self.translated = False + def __unicode__(self): + # for translated errors we only return the message + if self.translated: + return self.message.encode('utf-8') + + # otherwise attach some stuff location = 'line %d' % self.lineno name = self.filename or self.name if name: |