#10554: Response.set_cookie should allow setting two cookies of the same name.
------------------------------------+---------------------------------------
          Reporter:  jdunck         |         Owner:  nobody
            Status:  new            |     Milestone:        
         Component:  HTTP handling  |       Version:  1.0   
        Resolution:                 |      Keywords:        
             Stage:  Unreviewed     |     Has_patch:  0     
        Needs_docs:  0              |   Needs_tests:  0     
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by jdunck):

 OK, here's a plan for fix:

 Currently, Django's response.cookies is an instance of stdlib's
 Cookie.SimpleCookie(BaseCookie).

 BaseCookie is a subclass of dict, and so makes the assumption that there
 will be only one Morsel (that is, serializable cookie) per key.  Key is
 assumed to be string, because BaseCookie does things like .lower and
 .translate on it, and therefore, there can only be one morsel per cookie
 name.

 Here's the fix/hack: create a class which responds to the basestring
 methods, and takes all the HTTP-pertinent parameters (that is, name, path,
 domain, secure) into account for __cmp__ and __hash__.  Alter set_cookie
 to create an instance of that class as the key given to SimpleCookie.
 Respond to __str__ with just the cookie name.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10554#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to