Mercurial > genshi > genshi-test
changeset 80:d5db5e3aec58
* Improve template error messages
* Add the recently added support for seect('@*') to the TurboGears example.
author | cmlenz |
---|---|
date | Thu, 13 Jul 2006 19:13:02 +0000 |
parents | 16571c57907b |
children | cc034182061e |
files | examples/bench/run.py examples/turbogears/markuptest/templates/master.html examples/turbogears/markuptest/templates/welcome.html markup/template.py |
diffstat | 4 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- a/examples/turbogears/markuptest/templates/master.html +++ b/examples/turbogears/markuptest/templates/master.html @@ -4,7 +4,7 @@ py:strip=""> <xi:include href="sitetemplate.html"><xi:fallback/></xi:include> -<head py:match="head"> +<head py:match="head" py:attrs="select('@*')"> <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> <title py:replace="''">Your title goes here</title> ${select('*')} @@ -18,7 +18,7 @@ </style> </head> -<body py:match="body"> +<body py:match="body" py:attrs="select('@*')"> <div py:if="tg.config('identity.on', False) and not logging_in" id="pageLogin"> <span py:if="tg.identity.anonymous">
--- a/examples/turbogears/markuptest/templates/welcome.html +++ b/examples/turbogears/markuptest/templates/welcome.html @@ -9,7 +9,7 @@ <title>Welcome to TurboGears</title> </head> -<body> +<body id="welcome"> <p>Congratulations, your TurboGears application is running as of <span py:replace="now">now</span>.</p> <h2>Are you ready to Gear Up?</h2>
--- a/markup/template.py +++ b/markup/template.py @@ -71,6 +71,7 @@ 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) TemplateError.__init__(self, message) self.filename = filename self.lineno = lineno @@ -86,8 +87,9 @@ """ def __init__(self, name, filename='<string>', 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):