[Zope3-dev] Excessive long traceback info in TALES
Guido van Rossum
guido@python.org
Tue, 10 Dec 2002 12:40:35 -0500
When I make a simple mistake in a page template, I get a traceback.
This traceback takes a very long time to render, due to two lines in
Zope/PageTemplate/TALES.py, in the method evaluate():
__traceback_supplement__ = (
TALESTracebackSupplement, self, expression)
I don't exactly understand what this is for, but I note that the class
TALESTracebackSupplement (defined later in the same file) is
apparently instantiated as part of displaying the traceback, and
apparently one of the things it renders (without proper escaping of
'<' and '>' !) is a dict of all the module in the system; this is a
single line of about 16 KB in length.
I don't understand the code here (or its reason for existence) enough
to know what's the right thing to do; but the problem is annoying, so
I'd like to commit a band-aid solution, which would be to comment out
those two lines from evaluate().
OK?
BTW, Python 2.2 and later have a module "cgitb" which formats a
traceback in a nice way. Using it is as simple as calling
cgitb.html(sys.info()).
Maybe this could be used to replace the current sub-optimal traceback
(with no source code) that gets displayed?
--Guido van Rossum (home page: http://www.python.org/~guido/)