[Web-SIG] Sessions and Headers
grahamd at dscpl.com.au
Tue Dec 6 22:54:03 CET 2005
Timothy Soehnlin wrote ..
> Hello All,
> In a previous post I wrote about Sessions and Headers. The Sessions topic
> was addressed but the Headers point was never focused on. I was wondering
> about controlling headers in mod_python. In mod_python the headers are
> automagically submitted when the function write is invoked the first time.
> need this to not be. I need to have total control over the headers, and
> control when and if they are sent to the client. I was wondering if there
> are any settings, examples, etc that any of you all would know about.
Don't incrementally use req.write(), instead accumulate any response as
a list of strings or using StringIO instance. Then at the point that you
finally want to send content, ie., after you have set your headers, then
call req.write() once with the accumulated content.
Note that there is a separate mod_python mailing list, you would be
better off using that if you want to get a response. The mailing list
you are posting to is not specifically about mod_python and so you are
less likely to get a response. See the mod_python web site for how to
get onto the mod_python mailing list.
More information about the Web-SIG