Django

Code

Changeset 668

Show
Ignore:
Timestamp:
09/22/05 20:17:39 (3 years ago)
Author:
adrian
Message:

Fixed #236 -- Added HttpResponse.delete_cookie() method.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/httpwrappers.py

    r613 r668  
    176176                self.cookies[key][var.replace('_', '-')] = val 
    177177 
     178    def delete_cookie(self, key): 
     179        try: 
     180            self.cookies[key]['max_age'] = 0 
     181        except KeyError: 
     182            pass 
     183 
    178184    def get_content_as_string(self, encoding): 
    179185        """ 
  • django/trunk/docs/request_response.txt

    r613 r668  
    287287    .. _`cookie Morsel`: http://www.python.org/doc/current/lib/morsel-objects.html 
    288288 
     289``delete_cookie(key)`` 
     290    Deletes the cookie with the given key. Fails silently if the key doesn't 
     291    exist. 
     292 
    289293``get_content_as_string(encoding)`` 
    290294    Returns the content as a Python string, encoding it from a Unicode object