How to Delete a Cookie?

2009-01-08 Thread tryg . olson
Hello - I managed to get a cookie set. Now I want to delete it but it is not working. Do I need to do another 'set-cookie' in the HTTP header? I tried (code below setting expires to 0) and it didn't work. c = Cookie.SimpleCookie(os.environ[HTTP_COOKIE]) c[mycook][expires] = 0 print c In case

Re: How to Delete a Cookie?

2009-01-08 Thread Mike Driscoll
On Jan 8, 9:16 am, tryg.ol...@gmail.com wrote: Hello - I managed to get a cookie set.  Now I want to delete it but it is not working. Do I need to do another 'set-cookie' in the HTTP header?  I tried (code below setting expires to 0) and it didn't work. c =

Re: How to Delete a Cookie?

2009-01-08 Thread mk
tryg.ol...@gmail.com wrote: Hello - I managed to get a cookie set. Now I want to delete it but it is not working. Why struggle with this manually? Isn't it better to learn a bit of framework like Pylons and have it all done for you (e.g. in Pylons you have response.delete_cookie method)?

Re: How to Delete a Cookie?

2009-01-08 Thread Jose C
c[mycook][expires] = 0 Set [expires] using the following format to any time less than current (which causes the browser to delete the cookie). Here's a function I use to return a cookie expiry timestamp, negative values passed in result in cookie being deleted. def cookie_expiry_date(numdays):

Re: How to Delete a Cookie?

2009-01-08 Thread tryg . olson
On Jan 8, 1:16 pm, Jose C houdinihoun...@gmail.com wrote: c[mycook][expires] = 0 Set [expires] using the following format to any time less than current (which causes the browser to delete the cookie). Here's a function I use to return a cookie expiry timestamp, negative values passed in

Re: How to Delete a Cookie?

2009-01-08 Thread Jose C
On Jan 8, 10:33 am, tryg.ol...@gmail.com wrote: On Jan 8, 1:16 pm, Jose C houdinihoun...@gmail.com wrote: c[mycook][expires] = 0 Set [expires] using the following format to any time less than current (which causes the browser to delete the cookie). Here's a function I use to return a

Re: How to Delete a Cookie?

2009-01-08 Thread Jose C
To kill the cookie, simply set a cookie with the same name (and path) Actually you may not even need to specify the path. Just the name and expires param should do the trick. Haven't played with cookies in a while so try with and without the path. --