Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
bdcfff98
Commit
bdcfff98
authored
Apr 25, 2011
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Failed attempts at a fix for Py2.7
parent
4e1dbdd7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
fs/rpcfs.py
+1
-3
fs/sftpfs.py
+20
-8
No files found.
fs/rpcfs.py
View file @
bdcfff98
...
...
@@ -137,9 +137,7 @@ class RPCFS(FS):
return
state
def
__setstate__
(
self
,
state
):
for
(
k
,
v
)
in
state
.
iteritems
():
self
.
__dict__
[
k
]
=
v
self
.
_lock
=
threading
.
RLock
()
super
(
RPCFS
,
self
)
.
__setstate__
(
state
)
self
.
proxy
=
self
.
_make_proxy
()
def
encode_path
(
self
,
path
):
...
...
fs/sftpfs.py
View file @
bdcfff98
...
...
@@ -25,6 +25,9 @@ class WrongHostKeyError(RemoteConnectionError):
# SFTPClient appears to not be thread-safe, so we use an instance per thread
if
hasattr
(
threading
,
"local"
):
thread_local
=
threading
.
local
#class TL(object):
# pass
#thread_local = TL
else
:
class
thread_local
(
object
):
def
__init__
(
self
):
...
...
@@ -207,24 +210,33 @@ class SFTPFS(FS):
return
state
def
__setstate__
(
self
,
state
):
for
(
k
,
v
)
in
state
.
iteritems
():
self
.
__dict__
[
k
]
=
v
self
.
_lock
=
threading
.
RLock
()
super
(
SFTPFS
,
self
)
.
__setstate__
(
state
)
#for (k,v) in state.iteritems():
# self.__dict__[k] = v
#self._lock = threading.RLock()
self
.
_tlocal
=
thread_local
()
if
self
.
_owns_transport
:
self
.
_transport
=
paramiko
.
Transport
(
self
.
_transport
)
self
.
_transport
.
connect
(
**
self
.
_credentials
)
@property
@synchronize
def
client
(
self
):
try
:
return
self
.
_tlocal
.
client
except
AttributeError
:
#if self._transport is None:
# return self._client
client
=
getattr
(
self
.
_tlocal
,
'client'
,
None
)
if
client
is
None
:
if
self
.
_transport
is
None
:
return
self
.
_client
client
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
_transport
)
self
.
_tlocal
.
client
=
client
return
client
# try:
# return self._tlocal.client
# except AttributeError:
# #if self._transport is None:
# # return self._client
# client = paramiko.SFTPClient.from_transport(self._transport)
# self._tlocal.client = client
# return client
@synchronize
def
close
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment