Hi All,

Ever noticed how tracebacks from ZPT are actually quite useful when viewed through the error_log object, but totally useless when they fail, say, in a unit test?

This bugged me, so I had a dig, and just discovered this cool monkey patch, to be inserted in any module that gets imported before an exception is raised:

import traceback
from zExceptions.ExceptionFormatter import format_exception
traceback.format_exception = format_exception

So now I'm mailing you lot for two reasons:

1. This makes life a lot easier when debugging failing unit tests and looking through entries in event.log that have tracebacks, so I thought I'd share it :-)

2. I wonder if there's anything bad that can happen as a result of this?

If the answer to 2 is "no", then I'm gonna wrap this up into a minute product...



Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to