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

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


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

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/http.py 1.9 => 1.10 ===
--- Zope3/src/zope/publisher/http.py:1.9	Tue Feb 11 11:41:47 2003
+++ Zope3/src/zope/publisher/http.py	Thu Feb 27 03:11:33 2003
@@ -730,7 +730,6 @@
 
     def setCookie(self, name, value, **kw):
         'See IHTTPResponse'
-
         cookies = self._cookies
         cookie = cookies.setdefault(name, {})
 
@@ -738,6 +737,11 @@
             cookie[k] = v
 
         cookie['value'] = value
+
+
+    def getCookie(self, name, default=None):
+        'See IHTTPResponse'
+        return self._cookies.get(name, default)
 
 
     def setCharset(self, charset=None):