[Python-Dev] cgitb.py for Python 2.2

Barry A. Warsaw barry@zope.com
Mon, 30 Jul 2001 23:04:03 -0400


>>>>> "KY" == Ka-Ping Yee <ping@lfw.org> writes:

    KY> What i'm proposing is that we toss cgitb.py into the standard
    KY> library (pretty small at about 100 lines, since all the heavy
    KY> lifting is in pydoc and inspect).  Then we can add this to
    KY> site.py:

No time right now to look at it, but I remember it looked pretty cool
at IPC9.  I'd like to merge in some of the ideas I've developed in
Mailman's driver script, which prints out the environment and some
other sys information.  driver always prints to a log file and
optionally to stdout (it has a STEALTH_MODE variable that's probably
equivalent to your SECRET).

One thing I tried very hard to do was to make driver bulletproof, so
that it only imported a very minimal amount of stuff, and that /any/
exception along the way would get caught and not allowed to percolate
up out of the top frame (which would cause a non-zero exit status and
unhelpful message in the browser).  About the only thing that isn't
caught are exceptions importing sys, but if that happens you have
bigger problems! :)

I'll take a closer look at cgitb.py when I get a chance, but I'm
generally +1 on the idea.

-Barry