Skip to content

Instantly share code, notes, and snippets.

@bitprophet
Created August 19, 2011 02:01
Show Gist options
  • Save bitprophet/d2001a767663e8aea0fa to your computer and use it in GitHub Desktop.
Save bitprophet/d2001a767663e8aea0fa to your computer and use it in GitHub Desktop.
From b4404901cb7b2667ef0c5fce19a9de5844004205 Mon Sep 17 00:00:00 2001
From: David Arthur <mumrah@gmail.com>
Date: Fri, 22 Jul 2011 18:52:51 -0400
Subject: [PATCH 2/2] Fixed a bug with callback=None (oops)
When constructing the real callback in sftp.put, was not checking if the
callback was None before wrapping it with functools.partial
---
fabric/sftp.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/fabric/sftp.py b/fabric/sftp.py
index b7504e0..aa92aa4 100644
--- a/fabric/sftp.py
+++ b/fabric/sftp.py
@@ -222,7 +222,10 @@ class SFTP(object):
file_obj.write(local_path.read())
file_obj.close()
local_path.seek(old_pointer)
- real_callback = partial(callback, real_local_path)
+ if callback is not None:
+ real_callback = partial(callback, real_local_path)
+ else:
+ real_callback = None
rattrs = self.ftp.put(real_local_path, remote_path, callback=real_callback)
# Clean up
if not local_is_path:
--
1.7.4.1
@mavdipak
Copy link

where does read_local_path comes from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment