Bob Ippolito wrote:
They probably use cgitb[1] from standard python distribution. It
could be
nice to integrate it to TG too...
What we should do is this:
http://blog.ianbicking.org/ajaxy-exception-catching.html
This will require some WSGIish work on CherryPy to be doable, I think.
But the non-interactive exception handler in Paste should be fairly easy
to apply right now, using
paste.exceptions.errormiddleware.handle_exception. That exception
formatter doesn't show local variables, unfortunately, though I'd like
to move that from the ajax exception handler into the main error handler
(the main one is fine to use in production, but the ajax one most
certainly is not).
Relatedly I've also started a branch at
svn://lesscode.org/kid/branches/paste-error-reporting that makes Kid use
the Paste (/Zope) exception hooks to display line numbers. It's not
terribly complete, and I doubt I personally will be able to really
complete it either, but I thought I'd try to give it a kick-off. Like
in Zope, it would be possible and reasonable to show the template local
variables, even if they aren't part of the local scope in the traceback.
cgitb is slightly different in how it shows tracebacks; it actually
parses the Python source to find symbols, and only shows those variables
regardless of whether they are local or global. But I find
local-scope-only to be differently but equally useful, and the ajax
stuff to be far more convenient for serious debugging. I like it more
than pdb.
Lastly, in the WSGI middleware it also adds a special WSGI-aware
traceback supplement, which will add information about the request (the
URI, variables, etc). TG could add its own framework-specific
information as well, and/or in the (hopefully temporary) absence of the
middleware wrapper it could use its own supplement.
Well... this might all be vague, since there's several parts to how this
all works and I'm sure I haven't explained them all, but I can try to
explain the particulars if there's particular questions.
The generated docs:
http://pythonpaste.org/module-paste.exceptions.errormiddleware.html
And this explains more about the way the exception hooks work (basically
it's all done by looking for specially-named local variables):
http://pythonpaste.org/module-paste.exceptions.collector.html
--
Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org