[mod_python] changing publisher `content' before sent to client

Jorey Bump list at joreybump.com
Tue Jan 16 14:53:06 EST 2007

Jaime Wyant wrote:

> Maybe I did not explain things very well?  

No, you explained your problem precisely.

> I am using 
> mod_python.publisher, which does its magic calling my functions 
> automagically.  In my called functions, I simply return a string.


> I hardcoded them because I sort of hacked this together about 4 or so 
> years ago --  you learn a lot in four years. Would I hardcode the server 
> name today - well no:).  (But this is not relevant to my question, imo).

You're right. Sorry for second-guessing. It's not easy to determine if 
the requested solution indicates lack of expertise. Of course, in this 
case, you're trying to solve a problem caused by your former newbie self. :)

> Yeah, it'd be better to fix the website, but I'm in a time crunch.  
> Plus, publisher.py is well written / commented.  So plugging in my fix 
> well was simple - about 4 lines IIRC.  (Nice job mod_python developers!)
> In the end, I guess there is no way to intercept the `req.write' call 
> before the publisher makes it.

There probably is. There is also an external module that might work for you:


Graham's discussed adding filter support to mod_python, as well, but I 
don't know how usable it is at the moment.

More information about the Mod_python mailing list