diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-11-27 13:18:34 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-11-27 13:18:34 +0000 |
commit | acbe3bdbab14da04c9be5278d1b6f0df8cff2729 (patch) | |
tree | dadcb5e6171251c2b1095ac995b1239f5daca7f8 /Lib/ftplib.py | |
parent | 2600a33219374c97c9f82ab03a2c8848a0bf63eb (diff) | |
download | cpython-git-acbe3bdbab14da04c9be5278d1b6f0df8cff2729.tar.gz |
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.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 7d46d83098..ad00e310bd 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -431,7 +431,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: @@ -441,12 +441,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 @@ -712,9 +713,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) |