summaryrefslogtreecommitdiff
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-02-11 06:12:03 +0000
committerGuido van Rossum <guido@python.org>2007-02-11 06:12:03 +0000
commit6308f632af1c51802e8917bc6494ea3f56ddabc4 (patch)
treebbbf764c7ee1fc61032410493a29a6df15dbeecc /Lib/urllib2.py
parentc23f270cb89d26833c084e332c563413205283a6 (diff)
downloadcpython-6308f632af1c51802e8917bc6494ea3f56ddabc4.tar.gz
- PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone;
and .keys(), .items(), .values() return dict views. The dict views aren't fully functional yet; in particular, they can't be compared to sets yet. but they are useful as "iterator wells". There are still 27 failing unit tests; I expect that many of these have fairly trivial fixes, but there are so many, I could use help.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 058397d7f8..60ff2609bd 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -281,7 +281,7 @@ class Request:
def header_items(self):
hdrs = self.unredirected_hdrs.copy()
hdrs.update(self.headers)
- return hdrs.items()
+ return list(hdrs.items())
class OpenerDirector:
def __init__(self):
@@ -710,7 +710,7 @@ class HTTPPasswordMgr:
domains = self.passwd.get(realm, {})
for default_port in True, False:
reduced_authuri = self.reduce_uri(authuri, default_port)
- for uris, authinfo in domains.iteritems():
+ for uris, authinfo in domains.items():
for uri in uris:
if self.is_suburi(uri, reduced_authuri):
return authinfo
@@ -1318,21 +1318,21 @@ class CacheFTPHandler(FTPHandler):
# first check for old ones
t = time.time()
if self.soonest <= t:
- for k, v in self.timeout.items():
+ for k, v in list(self.timeout.items()):
if v < t:
self.cache[k].close()
del self.cache[k]
del self.timeout[k]
- self.soonest = min(self.timeout.values())
+ self.soonest = min(list(self.timeout.values()))
# then check the size
if len(self.cache) == self.max_conns:
- for k, v in self.timeout.items():
+ for k, v in list(self.timeout.items()):
if v == self.soonest:
del self.cache[k]
del self.timeout[k]
break
- self.soonest = min(self.timeout.values())
+ self.soonest = min(list(self.timeout.values()))
class GopherHandler(BaseHandler):
def gopher_open(self, req):