Re: cookie.delete doesn't take domain, path, or secure
John Reese <[email protected]>
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
On 1/5/06, John Reese <[email protected]> wrote: > Currently, if you want to delete a cookie on a non-default path, you have to use > cookie.set(key, None, path=X) > which seems silly, so I propose the following patch. Comments welcome. > Yeah, I have a comment. Your patch is wrong. Man, don't you ever test anything? Yes, I'm talking to myself. Sorry, I have a fever.
cookie.patch
(application/octet-stream, 640 B)
Index: modules/cookie.py
===================================================================
--- modules/cookie.py (revision 815)
+++ modules/cookie.py (working copy)
@@ -49,9 +49,9 @@
if path: text = text + ';PATH=%s' % path
if secure: text = text + ';SECURE'
self._api.getModule('response').addHeader('Set-Cookie', text)
- def delete(self, key):
+ def delete(self, key, domain=None, path=None, secure=0):
"Delete browser cookie"
- self.set(key, None)
+ self.set(key, None, domain=domain, path=path, secure=secure)
def __delitem__(self, key):
"Delete browser cookie"
return self.delete(self, key)