diff options
author | Jeremy T. Bouse <jbouse@debian.org> | 2011-05-29 08:16:54 -0400 |
---|---|---|
committer | Jeremy T. Bouse <jbouse@debian.org> | 2011-05-29 08:16:54 -0400 |
commit | a88b8c8c0f591a3bfa8d7984343a27815184f495 (patch) | |
tree | 85986bed44cc7148c461d6aa7736b627b83c24fb /paramiko/sftp_client.py | |
parent | e299181a5dda25aed4879ebcbe1359604448b3ae (diff) | |
download | python-paramiko-a88b8c8c0f591a3bfa8d7984343a27815184f495.tar python-paramiko-a88b8c8c0f591a3bfa8d7984343a27815184f495.tar.gz |
Imported Upstream version 1.7.7.1upstream/1.7.7.1
Diffstat (limited to 'paramiko/sftp_client.py')
-rw-r--r-- | paramiko/sftp_client.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 1f11075..79a7761 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -533,7 +533,7 @@ class SFTPClient (BaseSFTP): """ return self._cwd - def put(self, localpath, remotepath, callback=None): + def put(self, localpath, remotepath, callback=None, confirm=True): """ Copy a local file (C{localpath}) to the SFTP server as C{remotepath}. Any exception raised by operations will be passed through. This @@ -549,6 +549,10 @@ class SFTPClient (BaseSFTP): transferred so far and the total bytes to be transferred (since 1.7.4) @type callback: function(int, int) + @param confirm: whether to do a stat() on the file afterwards to + confirm the file size (since 1.7.7) + @type confirm: bool + @return: an object containing attributes about the given file (since 1.7.4) @rtype: SFTPAttributes @@ -574,9 +578,12 @@ class SFTPClient (BaseSFTP): fr.close() finally: fl.close() - s = self.stat(remotepath) - if s.st_size != size: - raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) + if confirm: + s = self.stat(remotepath) + if s.st_size != size: + raise IOError('size mismatch in put! %d != %d' % (s.st_size, size)) + else: + s = SFTPAttributes() return s def get(self, remotepath, localpath, callback=None): |