[mod_python] question - Getting/Setting Cookies

David McNab david at rebirthing.co.nz
Thu Feb 12 17:26:50 EST 2004


I've been a longtime user of Cookie.SimpleCookie, as an easy way of 
getting/setting cookies within Python CGI scripts.

A couple of days ago, I installed mod_python.

While I'm impressed with the performance gain mod_python is giving me 
with its CGI handler, I suspect things can run faster still if I write 
my own handler.

Only problem is - I can't see a trivial way to get a Cookie object from 
the 'req' object which gets passed to one's mod_python handler.

So my question is - is there any code for getting a Cookie object from 
the 'req' object?

It's not too hard to write one - just a bit of farting about. But I'd 
rather not 'reinvent a wheel' if someone else has already done this.

But if I have to write it myself, here's another question - how do I get 
the raw http headers from 'req' as a bulk string, which I can pass to 

Thanks in advance for your help


Kind regards


leave this line intact so your email gets through my junk mail filter

More information about the Mod_python mailing list