[mod_python] apache's hook api in mod_python?

Kevin Wang kwang at activegrid.com
Wed Mar 9 14:39:21 EST 2005

Hi Graham,

Thanks a lot for your kind help!

My understanding of Apache C API's hook is that it allows module A to create 
a callback hook and all other modules can provide their own callback 
functions to hook on it, and then those callback functions can be called by 
module A at any time.

I doubt it can be replaced by Apache's filters, as filters themselves are 
hook callbacks which are called at various request processing stages.  If I 
am wrong or if there any smarter way to achieve what I want, please let me know.

I am cc'ing this email to mod_python development mailing list to see if this 
  does exist or it is a nice feature to have in the future.


-- Kevin

Graham Dumpleton wrote:
> Kevin Wang wrote ..
>>For my second question, actually it is unrelated with the first one.  In
>>Apache 2's C api, we can create a hook in a module, and all the other 
>>modules are able to call that hook at any time.  I am wondering if 
>>mod_python allows us to create our own hook (using python), and other 
>>modules (probably C implementations) can call that hook.
> That question I don't think I can answer.
> I haven't used them or even really looked at them, but one can use
> mod_python to create filters.
>   http://www.modpython.org/live/current/doc-html/pyapi-filter.html
> This isn't exactly direct callable from another module, but presume it
> would allow the output of another module to be filtered through something
> running under mod_python.
> Handlers in general may allow you implement some phases of a request
> otherwise handled by another module, but not sure as have always done
> everything under mod_python and not mixed it with other modules.
>   http://www.modpython.org/live/current/doc-html/pyapi-handler.html
> Don't know if this helps or not.
> You might grep through the source code for mod_python to see if you see
> the particular Apache API hook methods being used and deduce from that
> if it does what you are looking for.
> Graham

More information about the Mod_python mailing list