# HG changeset patch # User cmlenz # Date 1152817982 0 # Node ID e0957965553f2fa1ef13e54e73c803f6d2615553 # Parent 8d6bee631a58945dee8888bf350f874b433c5a2f * Improve template error messages * Add the recently added support for seect('@*') to the TurboGears example. diff --git a/examples/bench/run.py b/examples/bench/run.py --- a/examples/bench/run.py +++ b/examples/bench/run.py @@ -4,7 +4,7 @@ import sys import timeit -__all__ = ['markup', 'clearsilver', 'django', 'kid'] +__all__ = ['clearsilver', 'django', 'kid', 'markup', 'simpletal'] def markup(dirname): from markup.template import Context, TemplateLoader diff --git a/examples/turbogears/markuptest/templates/master.html b/examples/turbogears/markuptest/templates/master.html --- a/examples/turbogears/markuptest/templates/master.html +++ b/examples/turbogears/markuptest/templates/master.html @@ -4,7 +4,7 @@ py:strip=""> - + Your title goes here ${select('*')} @@ -18,7 +18,7 @@ - +
diff --git a/examples/turbogears/markuptest/templates/welcome.html b/examples/turbogears/markuptest/templates/welcome.html --- a/examples/turbogears/markuptest/templates/welcome.html +++ b/examples/turbogears/markuptest/templates/welcome.html @@ -9,7 +9,7 @@ Welcome to TurboGears - +

Congratulations, your TurboGears application is running as of now.

Are you ready to Gear Up?

diff --git a/markup/template.py b/markup/template.py --- a/markup/template.py +++ b/markup/template.py @@ -71,6 +71,7 @@ def __init__(self, message, filename='', 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) TemplateError.__init__(self, message) self.filename = filename self.lineno = lineno @@ -86,8 +87,9 @@ """ def __init__(self, name, filename='', lineno=-1): - TemplateSyntaxError.__init__(self, 'Bad directive "%s"' % name.localname, - filename, lineno) + msg = 'bad directive "%s" (%s, line %d)' % (name.localname, filename, + lineno) + TemplateSyntaxError.__init__(self, msg, filename, lineno) class TemplateNotFound(TemplateError):