diff markup/template.py @ 213:bafa1cc49c2f

Store original message in exceptions as `msg` ivar.
author cmlenz
date Thu, 31 Aug 2006 08:49:37 +0000
parents c0c70dc5bf95
children 813b7115d27f
line wrap: on
line diff
--- a/markup/template.py
+++ b/markup/template.py
@@ -45,7 +45,8 @@
     def __init__(self, message, filename='<string>', lineno=-1, offset=-1):
         if isinstance(message, SyntaxError) and message.lineno is not None:
             message = str(message).replace(' (line %d)' % message.lineno, '')
-        message = '%s (%s, line %d)' % (message, filename, lineno)
+        self.msg = message
+        message = '%s (%s, line %d)' % (self.msg, filename, lineno)
         TemplateError.__init__(self, message)
         self.filename = filename
         self.lineno = lineno
@@ -61,8 +62,8 @@
     """
 
     def __init__(self, name, filename='<string>', lineno=-1):
-        msg = 'bad directive "%s"' % name.localname
-        TemplateSyntaxError.__init__(self, msg, filename, lineno)
+        message = 'bad directive "%s"' % name.localname
+        TemplateSyntaxError.__init__(self, message, filename, lineno)
 
 
 class TemplateNotFound(TemplateError):
Copyright (C) 2012-2017 Edgewall Software