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):
...
@@ -137,9 +137,7 @@ class RPCFS(FS):
return
state
return
state
def
__setstate__
(
self
,
state
):
def
__setstate__
(
self
,
state
):
for
(
k
,
v
)
in
state
.
iteritems
():
super
(
RPCFS
,
self
)
.
__setstate__
(
state
)
self
.
__dict__
[
k
]
=
v
self
.
_lock
=
threading
.
RLock
()
self
.
proxy
=
self
.
_make_proxy
()
self
.
proxy
=
self
.
_make_proxy
()
def
encode_path
(
self
,
path
):
def
encode_path
(
self
,
path
):
...
...
fs/sftpfs.py
View file @
bdcfff98
...
@@ -25,6 +25,9 @@ class WrongHostKeyError(RemoteConnectionError):
...
@@ -25,6 +25,9 @@ class WrongHostKeyError(RemoteConnectionError):
# SFTPClient appears to not be thread-safe, so we use an instance per thread
# SFTPClient appears to not be thread-safe, so we use an instance per thread
if
hasattr
(
threading
,
"local"
):
if
hasattr
(
threading
,
"local"
):
thread_local
=
threading
.
local
thread_local
=
threading
.
local
#class TL(object):
# pass
#thread_local = TL
else
:
else
:
class
thread_local
(
object
):
class
thread_local
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -207,24 +210,33 @@ class SFTPFS(FS):
...
@@ -207,24 +210,33 @@ class SFTPFS(FS):
return
state
return
state
def
__setstate__
(
self
,
state
):
def
__setstate__
(
self
,
state
):
for
(
k
,
v
)
in
state
.
iteritems
():
super
(
SFTPFS
,
self
)
.
__setstate__
(
state
)
self
.
__dict__
[
k
]
=
v
#for (k,v) in state.iteritems():
self
.
_lock
=
threading
.
RLock
()
# self.__dict__[k] = v
#self._lock = threading.RLock()
self
.
_tlocal
=
thread_local
()
self
.
_tlocal
=
thread_local
()
if
self
.
_owns_transport
:
if
self
.
_owns_transport
:
self
.
_transport
=
paramiko
.
Transport
(
self
.
_transport
)
self
.
_transport
=
paramiko
.
Transport
(
self
.
_transport
)
self
.
_transport
.
connect
(
**
self
.
_credentials
)
self
.
_transport
.
connect
(
**
self
.
_credentials
)
@property
@property
@synchronize
def
client
(
self
):
def
client
(
self
):
try
:
client
=
getattr
(
self
.
_tlocal
,
'client'
,
None
)
return
self
.
_tlocal
.
client
if
client
is
None
:
except
AttributeError
:
if
self
.
_transport
is
None
:
#if self._transport is None:
return
self
.
_client
# return self._client
client
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
_transport
)
client
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
_transport
)
self
.
_tlocal
.
client
=
client
self
.
_tlocal
.
client
=
client
return
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
@synchronize
def
close
(
self
):
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