mod_python provides the PythonEnablePdb option for enabling of the Python debugger. For it to work properly though, it is necessary to start httpd from the command line with the -DONE_PROCESS option. If one doesn't do this though and enables PythonEnablePdb when Apache is running normally, any request to a URL for which the debugger is enabled will yield a 500 error. The details of the 500 error will be:
Mod_python error: "PythonHandler mptest"
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
assert (type(result) == type(int())), \
AssertionError: Handler 'mptest' returned invalid return code.
This error message isn't particularly helpful in understanding that the problem is that the debugger can't be run in this mode.
To avoid this problem at the moment, all that can be done is for the user to know that their Apache configuration should actually say:
This would mean they could leave the Apache configuration set the one way and not have to worry.
What could instead be done in mod_python though is simply to ignore the PythonEnablePdb option and that it is set if Apache hasn't been run in ONE_PROCESS mode. Thus, presuming that
MODPYTHON-89 has been implemented, the mod_python code in mod_python.apache in the number of places where it occurs, could say:
- call the object
if exists_config_define("ONE_PROCESS") and config.has_key("PythonEnablePdb"):
result = pdb.runcall(object, conn)
result = object(conn)