summaryrefslogtreecommitdiff
path: root/fs/sftpfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2011-08-07 15:12:10 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2011-08-07 15:12:10 +0000
commit19a25b721353cc4fc2ed7adcbdb1709dc83b621d (patch)
treeba26b1383d532e357fb9167533a74ddbcf343a90 /fs/sftpfs.py
parent038c0022c0d07069815ca46af0215ffa8ca2cf52 (diff)
downloadpyfilesystem-19a25b721353cc4fc2ed7adcbdb1709dc83b621d.tar.gz
Fixes and documentation
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@718 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/sftpfs.py')
-rw-r--r--fs/sftpfs.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/sftpfs.py b/fs/sftpfs.py
index 03f4b20..9bab5fc 100644
--- a/fs/sftpfs.py
+++ b/fs/sftpfs.py
@@ -139,10 +139,10 @@ class SFTPFS(FS):
if not connection.is_active():
raise RemoteConnectionError(msg='Unable to connect')
- if no_auth:
+ if no_auth:
try:
connection.auth_none('')
- except paramiko.SSHException:
+ except paramiko.SSHException:
pass
elif not connection.is_authenticated():
@@ -222,6 +222,8 @@ class SFTPFS(FS):
@property
@synchronize
def client(self):
+ if self.closed:
+ return None
client = getattr(self._tlocal, 'client', None)
if client is None:
if self._transport is None:
@@ -242,9 +244,10 @@ class SFTPFS(FS):
def close(self):
"""Close the connection to the remote server."""
if not self.closed:
- if self.client:
- self.client.close()
- if self._owns_transport and self._transport:
+ self._tlocal = None
+ #if self.client:
+ # self.client.close()
+ if self._owns_transport and self._transport and self._transport.is_active:
self._transport.close()
self.closed = True