[Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43
bcannon@users.sourceforge.net
bcannon@users.sourceforge.net
Mon, 12 May 2003 00:29:45 -0700
- Previous message: [Python-checkins] python/dist/src/Doc/lib liblocale.tex,1.32,1.33 libmimetools.tex,1.23,1.24 libpyexpat.tex,1.20,1.21 librepr.tex,1.3,1.4
- Next message: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv1764/Lib
Modified Files:
urllib2.py
Log Message:
Change Request.add_header to call string.capitalize in order to normalize
headers and not have any dependency on case. Closes patch #649742.
Also changed all instances of dict.items to dict.iteritems where appropriate.
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** urllib2.py 5 May 2003 04:09:13 -0000 1.42
--- urllib2.py 12 May 2003 07:29:42 -0000 1.43
***************
*** 194,198 ****
self.data = data
self.headers = {}
! self.headers.update(headers)
def __getattr__(self, attr):
--- 194,199 ----
self.data = data
self.headers = {}
! for key, value in headers.iteritems():
! self.add_header(key, value)
def __getattr__(self, attr):
***************
*** 249,253 ****
def add_header(self, key, val):
# useful for something like authentication
! self.headers[key] = val
class OpenerDirector:
--- 250,254 ----
def add_header(self, key, val):
# useful for something like authentication
! self.headers[key.capitalize()] = val
class OpenerDirector:
***************
*** 479,483 ****
assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
self.proxies = proxies
! for type, url in proxies.items():
setattr(self, '%s_open' % type,
lambda r, proxy=url, type=type, meth=self.proxy_open: \
--- 480,484 ----
assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
self.proxies = proxies
! for type, url in proxies.iteritems():
setattr(self, '%s_open' % type,
lambda r, proxy=url, type=type, meth=self.proxy_open: \
***************
*** 564,568 ****
domains = self.passwd.get(realm, {})
authuri = self.reduce_uri(authuri)
! for uris, authinfo in domains.items():
for uri in uris:
if self.is_suburi(uri, authuri):
--- 565,569 ----
domains = self.passwd.get(realm, {})
authuri = self.reduce_uri(authuri)
! for uris, authinfo in domains.iteritems():
for uri in uris:
if self.is_suburi(uri, authuri):
***************
*** 806,810 ****
if name not in req.headers:
h.putheader(*args)
! for k, v in req.headers.items():
h.putheader(k, v)
# httplib will attempt to connect() here. be prepared
--- 807,811 ----
if name not in req.headers:
h.putheader(*args)
! for k, v in req.headers.iteritems():
h.putheader(k, v)
# httplib will attempt to connect() here. be prepared
***************
*** 1013,1017 ****
t = time.time()
if self.soonest <= t:
! for k, v in self.timeout.items():
if v < t:
self.cache[k].close()
--- 1014,1018 ----
t = time.time()
if self.soonest <= t:
! for k, v in self.timeout.iteritems():
if v < t:
self.cache[k].close()
***************
*** 1022,1026 ****
# then check the size
if len(self.cache) == self.max_conns:
! for k, v in self.timeout.items():
if v == self.soonest:
del self.cache[k]
--- 1023,1027 ----
# then check the size
if len(self.cache) == self.max_conns:
! for k, v in self.timeout.iteritems():
if v == self.soonest:
del self.cache[k]
- Previous message: [Python-checkins] python/dist/src/Doc/lib liblocale.tex,1.32,1.33 libmimetools.tex,1.23,1.24 libpyexpat.tex,1.20,1.21 librepr.tex,1.3,1.4
- Next message: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]