mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed #236 -- Added HttpResponse.delete_cookie() method.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8df0df620f
commit
3dc1ede871
@ -175,6 +175,12 @@ class HttpResponse:
|
||||
if val is not None:
|
||||
self.cookies[key][var.replace('_', '-')] = val
|
||||
|
||||
def delete_cookie(self, key):
|
||||
try:
|
||||
self.cookies[key]['max_age'] = 0
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def get_content_as_string(self, encoding):
|
||||
"""
|
||||
Returns the content as a string, encoding it from a Unicode object if
|
||||
|
@ -286,6 +286,10 @@ Methods
|
||||
|
||||
.. _`cookie Morsel`: http://www.python.org/doc/current/lib/morsel-objects.html
|
||||
|
||||
``delete_cookie(key)``
|
||||
Deletes the cookie with the given key. Fails silently if the key doesn't
|
||||
exist.
|
||||
|
||||
``get_content_as_string(encoding)``
|
||||
Returns the content as a Python string, encoding it from a Unicode object
|
||||
if necessary.
|
||||
|
Loading…
Reference in New Issue
Block a user