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
27817894
Commit
27817894
authored
Apr 19, 2012
by
btimby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some cleanup, more PEP8 stuff
parent
9bd13511
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
fs/expose/sftp.py
+10
-11
No files found.
fs/expose/sftp.py
View file @
27817894
...
@@ -124,22 +124,21 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
...
@@ -124,22 +124,21 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
path
=
path
.
decode
(
self
.
encoding
)
path
=
path
.
decode
(
self
.
encoding
)
info
=
self
.
fs
.
getinfo
(
path
)
info
=
self
.
fs
.
getinfo
(
path
)
get
=
info
.
get
stat
=
paramiko
.
SFTPAttributes
()
stat
=
paramiko
.
SFTPAttributes
()
stat
.
filename
=
basename
(
path
)
.
encode
(
self
.
encoding
)
stat
.
filename
=
basename
(
path
)
.
encode
(
self
.
encoding
)
stat
.
st_size
=
info
.
get
(
"size"
)
stat
.
st_size
=
info
.
get
(
"size"
)
if
'st_atime'
in
info
:
if
'st_atime'
in
info
:
stat
.
st_atime
=
get
(
'st_atime'
)
stat
.
st_atime
=
info
.
get
(
'st_atime'
)
elif
'accessed_time'
in
info
:
elif
'accessed_time'
in
info
:
stat
.
st_atime
=
time
.
mktime
(
get
(
"accessed_time"
)
.
timetuple
())
stat
.
st_atime
=
time
.
mktime
(
info
.
get
(
"accessed_time"
)
.
timetuple
())
if
'st_mtime'
in
info
:
if
'st_mtime'
in
info
:
stat
.
st_mtime
=
get
(
'st_mtime'
)
stat
.
st_mtime
=
info
.
get
(
'st_mtime'
)
else
:
else
:
if
'modified_time'
in
info
:
if
'modified_time'
in
info
:
stat
.
st_mtime
=
time
.
mktime
(
get
(
"modified_time"
)
.
timetuple
())
stat
.
st_mtime
=
time
.
mktime
(
info
.
get
(
"modified_time"
)
.
timetuple
())
if
isdir
(
self
.
fs
,
path
,
info
):
if
isdir
(
self
.
fs
,
path
,
info
):
stat
.
st_mode
=
0777
|
statinfo
.
S_IFDIR
stat
.
st_mode
=
0777
|
statinfo
.
S_IFDIR
...
@@ -152,7 +151,7 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
...
@@ -152,7 +151,7 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
@report_sftp_errors
@report_sftp_errors
def
remove
(
self
,
path
):
def
remove
(
self
,
path
):
if
not
isinstance
(
path
,
unicode
):
if
not
isinstance
(
path
,
unicode
):
path
=
path
.
decode
(
self
.
encoding
)
path
=
path
.
decode
(
self
.
encoding
)
self
.
fs
.
remove
(
path
)
self
.
fs
.
remove
(
path
)
return
paramiko
.
SFTP_OK
return
paramiko
.
SFTP_OK
...
@@ -178,7 +177,7 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
...
@@ -178,7 +177,7 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
@report_sftp_errors
@report_sftp_errors
def
rmdir
(
self
,
path
):
def
rmdir
(
self
,
path
):
if
not
isinstance
(
path
,
unicode
):
if
not
isinstance
(
path
,
unicode
):
path
=
path
.
decode
(
self
.
encoding
)
path
=
path
.
decode
(
self
.
encoding
)
self
.
fs
.
removedir
(
path
)
self
.
fs
.
removedir
(
path
)
return
paramiko
.
SFTP_OK
return
paramiko
.
SFTP_OK
...
@@ -215,10 +214,10 @@ class SFTPHandle(paramiko.SFTPHandle):
...
@@ -215,10 +214,10 @@ class SFTPHandle(paramiko.SFTPHandle):
super
(
SFTPHandle
,
self
)
.
__init__
(
flags
)
super
(
SFTPHandle
,
self
)
.
__init__
(
flags
)
mode
=
flags_to_mode
(
flags
)
+
"b"
mode
=
flags_to_mode
(
flags
)
+
"b"
self
.
owner
=
owner
self
.
owner
=
owner
if
not
isinstance
(
path
,
unicode
):
if
not
isinstance
(
path
,
unicode
):
path
=
path
.
decode
(
self
.
owner
.
encoding
)
path
=
path
.
decode
(
self
.
owner
.
encoding
)
self
.
path
=
path
self
.
path
=
path
self
.
_file
=
owner
.
fs
.
open
(
path
,
mode
)
self
.
_file
=
owner
.
fs
.
open
(
path
,
mode
)
@report_sftp_errors
@report_sftp_errors
def
close
(
self
):
def
close
(
self
):
...
@@ -240,7 +239,7 @@ class SFTPHandle(paramiko.SFTPHandle):
...
@@ -240,7 +239,7 @@ class SFTPHandle(paramiko.SFTPHandle):
return
self
.
owner
.
stat
(
self
.
path
)
return
self
.
owner
.
stat
(
self
.
path
)
def
chattr
(
self
,
attr
):
def
chattr
(
self
,
attr
):
return
self
.
owner
.
chattr
(
self
.
path
,
attr
)
return
self
.
owner
.
chattr
(
self
.
path
,
attr
)
class
SFTPRequestHandler
(
SocketServer
.
BaseRequestHandler
):
class
SFTPRequestHandler
(
SocketServer
.
BaseRequestHandler
):
...
@@ -260,7 +259,7 @@ class SFTPRequestHandler(SocketServer.BaseRequestHandler):
...
@@ -260,7 +259,7 @@ class SFTPRequestHandler(SocketServer.BaseRequestHandler):
so
.
digests
=
(
'hmac-sha1'
,
)
so
.
digests
=
(
'hmac-sha1'
,
)
so
.
compression
=
(
'zlib@openssh.com'
,
'none'
)
so
.
compression
=
(
'zlib@openssh.com'
,
'none'
)
self
.
transport
.
add_server_key
(
self
.
server
.
host_key
)
self
.
transport
.
add_server_key
(
self
.
server
.
host_key
)
self
.
transport
.
set_subsystem_handler
(
"sftp"
,
paramiko
.
SFTPServer
,
SFTPServerInterface
,
self
.
server
.
fs
,
self
.
server
.
encoding
)
self
.
transport
.
set_subsystem_handler
(
"sftp"
,
paramiko
.
SFTPServer
,
SFTPServerInterface
,
self
.
server
.
fs
,
encoding
=
self
.
server
.
encoding
)
def
handle
(
self
):
def
handle
(
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