[mod_python] PSP content-type problem

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Sep 27 11:40:50 EDT 2004



On Sun, 26 Sep 2004, Robert Fendt wrote:

> I think that matches with my earlier remark about psp.PSP.__str()__ not
> actually returning a string (in fact, it returns ""). In my opinion, it
> really should do that.

But how would that work? The PSP object uses the request object to send 
its output, which in turn sends it out the filter stack and out to the 
socket.

To get a string, you'd need a fake request object that uses a StringIO or 
something to buffer the output, but this output isn't going to reflect the 
real picture because it would not be subject to any other filter/module in 
httpd, and if the PSP page makes use of any request specific features 
(e.g. internal redirect), the fake request object isn't going to support 
it. The bottom line is not nearly as simple as it seems. :-)

Grisha


More information about the Mod_python mailing list