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

Matt Barnicle mattb at wageslavery.org
Mon Jan 21 17:38:58 EST 2008


> 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@





More information about the Mod_python mailing list