[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.13
Steve Alexander
steve@cat-box.net
Sun, 2 Mar 2003 13:09:33 -0500
Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv8037/src/zope/publisher
Modified Files:
http.py
Log Message:
A keyword argument value of None when setting a cookie causes that
keyword argument to be ignored. This is useful when you have a case
where you sometimes want to set that value, and sometimes do not.
Made the lifespan of cookies in the session cookie service come from
an instance variable, rather than being hard-coded.
=== Zope3/src/zope/publisher/http.py 1.12 => 1.13 ===
--- Zope3/src/zope/publisher/http.py:1.12 Fri Feb 28 17:57:31 2003
+++ Zope3/src/zope/publisher/http.py Sun Mar 2 13:09:02 2003
@@ -700,7 +700,8 @@
if name in headers:
h = self._header[name]
h = "%s%s\r\n\t%s" % (h, delimiter, value)
- else: h = value
+ else:
+ h = value
self.setHeader(name, h)
@@ -709,17 +710,20 @@
cookies = self._cookies
if name in cookies:
cookie = cookies[name]
- else: cookie = cookies[name] = {}
+ else:
+ cookie = cookies[name] = {}
if 'value' in cookie:
cookie['value'] = '%s:%s' % (cookie['value'], value)
- else: cookie['value'] = value
+ else:
+ cookie['value'] = value
def expireCookie(self, name, **kw):
'See IHTTPResponse'
dict = {'max_age':0, 'expires':'Wed, 31-Dec-97 23:59:59 GMT'}
for k, v in kw.items():
- dict[k] = v
+ if v is not None:
+ dict[k] = v
cookies = self._cookies
if name in cookies:
# Cancel previous setCookie().
@@ -733,7 +737,8 @@
cookie = cookies.setdefault(name, {})
for k, v in kw.items():
- cookie[k] = v
+ if v is not None:
+ cookie[k] = v
cookie['value'] = value