[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - HTTPRequest.py:1.1.2.30 HTTPResponse.py:1.1.2.19
Jim Fulton
jim@zope.com
Mon, 10 Jun 2002 15:34:57 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/HTTP
In directory cvs.zope.org:/tmp/cvs-serv5490/lib/python/Zope/Publisher/HTTP
Modified Files:
Tag: Zope-3x-branch
HTTPRequest.py HTTPResponse.py
Log Message:
Implemented
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/IContainerPythonification
Along the way:
- Converted most uses of has_key to use in.
- Fixed a bug in Interface names and namesAndDescriptions methods
that caused base class attributes to be missed.
=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.1.2.29 => 1.1.2.30 ===
environ = sane_environment(environ)
- if environ.has_key('HTTP_AUTHORIZATION'):
+ if 'HTTP_AUTHORIZATION' in environ:
self._auth = environ['HTTP_AUTHORIZATION']
del environ['HTTP_AUTHORIZATION']
else:
@@ -485,7 +485,7 @@
while key.startswith('REDIRECT_'):
key=key[9:]
dict[key]=val
- if dict.has_key('HTTP_CGI_AUTHORIZATION'):
+ if 'HTTP_CGI_AUTHORIZATION' in dict:
dict['HTTP_AUTHORIZATION']=dict['HTTP_CGI_AUTHORIZATION']
try: del dict['HTTP_CGI_AUTHORIZATION']
except: pass
=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPResponse.py 1.1.2.18 => 1.1.2.19 ===
if isinstance(status, StringType):
status = status.lower()
- if status_codes.has_key(status):
+ if status in status_codes:
status = status_codes[status]
else:
status = 500
@@ -151,7 +151,7 @@
if reason is None:
if status == 200:
reason = 'Ok'
- elif status_reasons.has_key(status):
+ elif status in status_reasons:
reason = status_reasons[status]
else:
reason = 'Unknown'
@@ -190,8 +190,8 @@
result = {}
headers = self._headers
- if (not self._streaming and not headers.has_key('content-length')
- and not headers.has_key('transfer-encoding')):
+ if (not self._streaming and not ('content-length' in headers)
+ and not ('transfer-encoding' in headers)):
self._updateContentLength()
result["X-Powered-By"] = "Zope (www.zope.org), Python (www.python.org)"
@@ -215,7 +215,7 @@
def appendToHeader(self, name, value, delimiter=','):
'See Zope.Publisher.HTTP.IHTTPResponse.IHTTPResponse'
headers = self._headers
- if headers.has_key(name):
+ if name in headers:
h = self._header[name]
h = "%s%s\r\n\t%s" % (h, delimiter, value)
else: h = value
@@ -225,9 +225,10 @@
def appendToCookie(self, name, value):
'See Zope.Publisher.HTTP.IHTTPResponse.IHTTPResponse'
cookies = self._cookies
- if cookies.has_key(name): cookie = cookies[name]
+ if name in cookies:
+ cookie = cookies[name]
else: cookie = cookies[name] = {}
- if cookie.has_key('value'):
+ if 'value' in cookie:
cookie['value'] = '%s:%s' % (cookie['value'], value)
else: cookie['value'] = value
@@ -238,7 +239,7 @@
for k, v in kw.items():
dict[k]=v
cookies=self._cookies
- if cookies.has_key(name):
+ if name in cookies:
# Cancel previous setCookie().
del cookies[name]
self.setCookie(name, 'deleted', **dict)
@@ -246,12 +247,16 @@
def setCookie(self, name, value, **kw):
'See Zope.Publisher.HTTP.IHTTPResponse.IHTTPResponse'
+
cookies=self._cookies
- if cookies.has_key(name):
+ if name in cookies:
cookie=cookies[name]
- else: cookie=cookies[name]={}
+ else:
+ cookie=cookies[name]={}
+
for k, v in kw.items():
cookie[k]=v
+
cookie['value']=value
#