[Zope3-checkins] CVS: Zope3/src/zope/publisher/interfaces - http.py:1.6

Steve Alexander steve@cat-box.net
Thu, 27 Feb 2003 03:11:37 -0500


Update of /cvs-repository/Zope3/src/zope/publisher/interfaces
In directory cvs.zope.org:/tmp/cvs-serv1778/src/zope/publisher/interfaces

Modified Files:
	http.py 
Log Message:
Added a method getCookie to IHTTPResponse.
I needed this to fix a bug in sessions, where if you asked for the session
more than once in the same request, it wouldn't realise that it had already
created a session for that request. This was because the sessions code
was only looking in the request for the relevant cookie. It needs to look
in the response and in the request.


=== Zope3/src/zope/publisher/interfaces/http.py 1.5 => 1.6 ===
--- Zope3/src/zope/publisher/interfaces/http.py:1.5	Wed Feb 19 10:24:49 2003
+++ Zope3/src/zope/publisher/interfaces/http.py	Thu Feb 27 03:11:34 2003
@@ -108,7 +108,6 @@
 
         Data are returned as a mapping object, mapping cookie name to value.
         """
-
         return IMapping(str, str)
 
     cookies = Attribute(
@@ -297,6 +296,14 @@
         cookie-enabled browsers with a key "name" and value
         "value". This overwrites any previously set value for the
         cookie in the Response object.
+        """
+
+    def getCookie(name, default=None):
+        """Gets HTTP cookie data as a dict
+
+        Returns the dict of values associated with an HTTP cookie set in the
+        response, or 'default' if no such cookie has been set in the response
+        yet.
         """
 
     def appendToHeader(name, value, delimiter=","):