Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: Lib/urllib/request.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/unittest/test/test_case.py ('k') | Lib/urllib/response.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/urllib/request.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/urllib/request.py Mon Jul 25 09:47:18 2011 -0400
@@ -1371,8 +1371,8 @@
raise exc.with_traceback(sys.exc_info()[2])
def connect_ftp(self, user, passwd, host, port, dirs, timeout):
- return ftpwrapper(user, passwd, host, port, dirs, timeout,
- persistent=False)
+ fw = ftpwrapper(user, passwd, host, port, dirs, timeout)
+ return fw
class CacheFTPHandler(FTPHandler):
# XXX would be nice to have pluggable cache strategies
@@ -1421,13 +1421,6 @@
break
self.soonest = min(list(self.timeout.values()))
- def clear_cache(self):
- for conn in self.cache.values():
- conn.close()
- self.cache.clear()
- self.timeout.clear()
-
-
# Code move from the old urllib module
MAXFTPCACHE = 10 # Trim the ftp cache beyond this size
@@ -2151,16 +2144,13 @@
class ftpwrapper:
"""Class used by open_ftp() for cache of open FTP connections."""
- def __init__(self, user, passwd, host, port, dirs, timeout=None,
- persistent=True):
+ def __init__(self, user, passwd, host, port, dirs, timeout=None):
self.user = user
self.passwd = passwd
self.host = host
self.port = port
self.dirs = dirs
self.timeout = timeout
- self.refcount = 0
- self.keepalive = persistent
self.init()
def init(self):
@@ -2211,8 +2201,7 @@
conn, retrlen = self.ftp.ntransfercmd(cmd)
self.busy = 1
- ftpobj = addclosehook(conn.makefile('rb'), self.file_close)
- self.refcount += 1
+ ftpobj = addclosehook(conn.makefile('rb'), self.endtransfer)
conn.close()
# Pass back both a suitably decorated object and a retrieval length
return (ftpobj, retrlen)
@@ -2227,17 +2216,6 @@
pass
def close(self):
- self.keepalive = False
- if self.refcount <= 0:
- self.real_close()
-
- def file_close(self):
- self.endtransfer()
- self.refcount -= 1
- if self.refcount <= 0 and not self.keepalive:
- self.real_close()
-
- def real_close(self):
self.endtransfer()
try:
self.ftp.close()
« no previous file with comments | « Lib/unittest/test/test_case.py ('k') | Lib/urllib/response.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+