Skip to content
Myr

Added a (ugly) hack to the exceptions so that they don't warn under 2.6

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 5109717 · Browse files · 1 file+13 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−4 removed

  • other:+13 added−4 removed

1 file+13 added−4 removed

modified:jinja2/exceptions.py+13 added-4 removed
11 unmodified lines
1213class TemplateError(Exception):14 """Baseclass for all template errors."""1516 def __init__(self, message=None):17 if message is not None:18 message = unicode(message).encode('utf-8')19 Exception.__init__(self, message)2021 @property22 def message(self):23 if self.args:24 message = self.args[0]25 if message is not None:26 return message.decode('utf-8', 'replace')272829class TemplateNotFound(IOError, LookupError, TemplateError):30 """Raised if a template does not exist."""3132 def __init__(self, name):
4 unmodified lines
37class TemplateSyntaxError(TemplateError):38 """Raised to tell the user that there is a problem with the template."""3940 def __init__(self, message, lineno, name=None, filename=None):29 if not isinstance(message, unicode):30 message = message.decode('utf-8', 'replace')31 TemplateError.__init__(self, message.encode('utf-8'))41 TemplateError.__init__(self, message)42 self.lineno = lineno43 self.name = name44 self.filename = filename45 self.source = None36 self.message = message4647 def __unicode__(self):48 location = 'line %d' % self.lineno49 name = self.filename or self.name
47 unmodified lines