[Python-Dev] cgitb.py for Python 2.2

Barry A. Warsaw barry@zope.com
Tue, 31 Jul 2001 06:54:54 -0400


>>>>> "GvR" == Guido van Rossum <guido@zope.com> writes:

    >> What i'm proposing is that we toss cgitb.py into the standard
    >> library (pretty small at about 100 lines, since all the heavy
    >> lifting is in pydoc and inspect).  Then we can add this to
    >> site.py: if os.environ.has_key("GATEWAY_INTERFACE"): import
    >> sys, cgitb sys.excepthook = cgitb.excepthook

    GvR> Why not add this to cgi.py instead?  Th site.py
    GvR> initialization is accumulating a lot of cruft, and I don't
    GvR> like new additions that are irrelevant for most apps (CGI is
    GvR> a tiny niche for Python IMO).  (I also think all the stuff
    GvR> that's only for interactive mode should be moved off to
    GvR> another module that is only run in interactive mode.)

I'm at best +0 on adding it to site.py too.  E.g. for performance
reasons Mailman's cgi wrappers invoke Python with -S to avoid the
expensive overhead of importing site.py for each cgi hit.

-Barry