diff options
author | Guido van Rossum <guido@python.org> | 2007-02-11 06:12:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-02-11 06:12:03 (GMT) |
commit | cc2b0161257495f859200bce0aea3ed7e646feb3 (patch) | |
tree | ba09aba0de6447bef5be59b43fb86d17d760833d /Lib/urllib2.py | |
parent | 4e66dfcdc495218ad5f98b12ad6b4b2b05630ab0 (diff) | |
download | cpython-cc2b0161257495f859200bce0aea3ed7e646feb3.zip cpython-cc2b0161257495f859200bce0aea3ed7e646feb3.tar.gz cpython-cc2b0161257495f859200bce0aea3ed7e646feb3.tar.bz2 |
- 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.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 058397d..60ff260 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): |