[mod_python] can't seem to expire a cookie value

Matt Barnicle mattb at wageslavery.org
Mon Jan 21 03:49:57 EST 2008

hi everyone..  been working on this little nagging problem for about 3
hours now, not getting anywhere or finding anything on the net..  as i
understand it, if i want to effectively remove a cookie from the UA, there
is no way to do it, so u just have to set the expiry date to a time in the
past, right?  but any efforts i make seem to fail.  here is the code:

cookie = Cookie.Cookie('user_name', cookies['user_name'].value)
cookie.expires = int(time.time()) - 31536000 # minus 1 year from now
Cookie.add_cookie(self.req, cookie)

using mod_python 3.2.10

what gives?  i keep the user permanently logged in with a cookie value
until they click the log out link.  but because of this problem, i am
perpetually logged into my site because the cookie never expires.


- m@

More information about the Mod_python mailing list