[mod_python] cgihandler.py never returns 500

Paul paul at oz.net
Tue Jan 13 14:53:54 EST 2004


The cgihandler.py in mod_python 3.0.4 and earlier never seems
to return an HTTP 500 error (internal server error).  Code
snippet from cgihandler.py:

            # this executes the module
            imp.load_module(module_name, fd, path, desc)

            return apache.OK

Shouldn't this be something like:

            # this executes the module
            try:
                imp.load_module(module_name, fd, path, desc)
            except Exception, e:
                if e.args and type(e.args[0]) == types.IntType:
                    return e.args[0]
                else:
                    return apache.HTTP_INTERNAL_SERVER_ERROR

            return apache.OK

publisher.py has something similar implemented.

-- Paul



More information about the Mod_python mailing list