[mod_python] Cookie setting and reading

Deleersnyder, Sebastien sebastien.deleersnyder at be.unisys.com
Sat Sep 1 05:18:15 EST 2001


Hi,

This certainly has been discussed here before, but I do not seem to find 
any documentation/example on the following.

How do I set a cookie. And how do I read the same cookie back?

I think the following code should set the cookie and forces the browser to
save 
the cookie for a next logon (by setting the expiration date to the maximum).

req.headers_out['Set-Cookie']='key=value; path=/; expires=Wed, 09-Nov-2030
23:59:00 GMT'
req.send_http_header()

Only I am testing this with IE 6 and I do not see the cookie in my cookie
directory or privacy settings.
My privacy settings is configured to allow all cookies.

Next question:
If successfully set, how do I read the cookie when the client reconnects?
Is this a member of the request class?

regards,

Sebastien



More information about the Mod_python mailing list