[mod_python] How can one examine dynamically added handlers?

Joseph Barillari joeb at mit.edu
Wed Jan 4 22:20:22 EST 2006


I'm a big fan of mod_python -- I've been using it for a few days and
it's been great so far.

I'm a bit confused by the add_handler function, though.  Is there any
way to get a list (from within the PDB, for instance) of all the
dynamically registered handlers for a given request?

Because add_handler fails silently if the supplied handler is bogus,
it's not easy to figure out where problems lie. If I add a
PythonHandler with add_handler, and it doesn't get executed, is there
an easy way to tell if it didn't get executed because it (a) wasn't
the first handler on the list, (b) had an invalid module name, or (c)
some other reason?

I've dug around in the source; it appears that the handlers for future
phases (i.e., not the current phase) are stored in request_req->pool,
which isn't visible from within Python.

If specificity helps, my current problem is this: I have the following
two lines in a PythonTransHandler:


The PythonLogHandler gets executed, but the PythonHandler doesn't. I
suspect this is because the default action for log-handlers is to
execute everything, but the default action for content handlers
(PythonHandler) is to execute only the first handler in the list -- so
the default apache handler gets executed instead. I'm not sure how to
override this using add_handler.

thanks in advance,


More information about the Mod_python mailing list