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

Graham Dumpleton graham.dumpleton at gmail.com
Mon Jan 21 18:13:15 EST 2008

Have you checked what the actual cookie header returned to the browser
is and verified that what is in it is what you expect? Post the value
of the header here so we can see it.

Use FireFox live headers extension to see value of header, or in your
mod_python code output to error log file the output of req.headers_out
or req.err_headers_out to see what it is.


On 22/01/2008, Matt Barnicle <mattb at wageslavery.org> wrote:
> > 21 January 2008 Monday 10:49:57 tarihinde Matt Barnicle şunları
> yazmıştı:
> >> 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)
> >
> > Might be a problem of using int(), examples in the mod_python
> > documentation don't use int():
> >
> > http://www.modpython.org/live/current/doc-html/pyapi-cookie-example.html
> i first tried it exactly like in the docs, then i tried int bc i know the
> official way to do it is to use int seconds since GMT...  i also tried
> splitting time.time() on the period, and taking the int value of the first
> bit.  anyways it works ok when i log in then i check my cookies using
> firefox web developer toolbar, it just doesn't seem to want to expire the
> cookie when i use this method..
> - m@
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list