2007-04-19

Debugging page templates in doctests

Sometimes you get a page template error in doctests. The traceback does not point to the place in the page template that caused the error. Here's a quick, dirty and effective three liner to figure it out:

>>> import traceback
>>> from zope.exceptions.exceptionformatter import print_exception
>>> traceback.print_exception = print_exception

No comments: