Hey there, Dane. I ran in to this same problem, needing to delete a cookie. Just wanted to let you know the solution that worked for me was to ALSO set the path just as you would when you were setting the cookie.
For instance: - Setting the cookie: response.cookies['test_cookie'] = 'valid' response.cookies['test_cookie']['expires'] = 3600 response.cookies['test_cookie']['path'] = '/' - Delete cookie response.cookies['test_cookie'] = 'invalid' response.cookies['test_cookie']['expires'] = -10 response.cookies['test_cookie']['path'] = '/' Works for me. Let me know if you have any luck. Hope that helps! -Oliver On Feb 7, 2:11 pm, Dane <dane.schnei...@gmail.com> wrote: > Ok, now I'm using this code: > > for r in [request, response]: > if r.cookies.has_key('user'): > r.cookies['user']['expires'] = > datetime.datetime.strftime(datetime.datetime(2011,1,1,0,0), "%a, %d-%b- > %Y %H:%M:%S GMT") > print 'remove %s usercookie' % ('request' if r == request > else 'response') > > And still mycookieisn't going away... > > On Feb 7, 9:28 am, Massimo Di Pierro <massimo.dipie...@gmail.com> > wrote: > > > > > > > > >http://msdn.microsoft.com/en-us/library/ms178195.aspx > > > "You cannot directlydeleteacookieon a user's computer. However, > > you can direct the user's browser todeletethecookieby setting the > >cookie'sexpiration date to a past date. The next time a user makes a > > request to a page within the domain or path that set thecookie, the > > browser will determine that thecookiehas expired and remove it." > > > On Feb 7, 1:28 am, Dane <dane.schnei...@gmail.com> wrote: > > > > Hello, > > > > I've got my own user system (not using Auth), and I'm trying to > > > implement a Remember Me option with cookies. It's working fine when > > > the user selects 'Yes' for remember me. Setting and detecting the > > >cookieis no problem, but I can't find a way todeletethecookiewhen > > > the user logs out or selects 'No'. Here's my code which attempts > > > everything I can think of. > > > > if request.cookies.has_key('user'): > > > request.cookies['user'].clear() > > > del request.cookies['user'] > > > print 'remove request usercookie' > > > if response.cookies.has_key('user'): > > > response.cookies['user'].clear() > > > del response.cookies['user'] > > > print 'remove response usercookie' > > > > After running this, request.cookies.has_key('user') is still returning > > > true and thecookie'sdata is still present. > > > > Ideas? Thanks.