summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-11-27 13:23:26 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-11-27 13:23:26 (GMT)
commit648bcd706882a5ed83b7455ab3cf68734f92c6a4 (patch)
tree2da19c61e238ecd62565fbcd89ff344531f395f1 /Lib/ftplib.py
parent1a305fd141ebe4295d554d8b127ab982858a079e (diff)
downloadcpython-648bcd706882a5ed83b7455ab3cf68734f92c6a4.zip
cpython-648bcd706882a5ed83b7455ab3cf68734f92c6a4.tar.gz
cpython-648bcd706882a5ed83b7455ab3cf68734f92c6a4.tar.bz2
Merged revisions 76546 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76546 | antoine.pitrou | 2009-11-27 14:18:34 +0100 (ven., 27 nov. 2009) | 7 lines Issue #6845: Add restart support for binary upload in ftplib. The `storbinary()` method of FTP and FTP_TLS objects gains an optional `rest` argument. Patch by Pablo Mouzo. (note: the patch also adds a test for the rest argument in retrbinary()) ........
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 13e1e8a..ea3f996 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -433,7 +433,7 @@ class FTP:
conn.close()
return self.voidresp()
- def storbinary(self, cmd, fp, blocksize=8192, callback=None):
+ def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None):
"""Store a file in binary mode. A new port is created for you.
Args:
@@ -443,12 +443,13 @@ class FTP:
the connection at once. [default: 8192]
callback: An optional single parameter callable that is called on
on each block of data after it is sent. [default: None]
+ rest: Passed to transfercmd(). [default: None]
Returns:
The response code.
"""
self.voidcmd('TYPE I')
- conn = self.transfercmd(cmd)
+ conn = self.transfercmd(cmd, rest)
while 1:
buf = fp.read(blocksize)
if not buf: break
@@ -714,9 +715,9 @@ else:
conn.close()
return self.voidresp()
- def storbinary(self, cmd, fp, blocksize=8192, callback=None):
+ def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None):
self.voidcmd('TYPE I')
- conn = self.transfercmd(cmd)
+ conn = self.transfercmd(cmd, rest)
try:
while 1:
buf = fp.read(blocksize)