Skip to content

Commit 08bac4b

Browse files
author
Travis Cunningham
committed
Update fs.expose.ftp for compatibility with latest pyftpdlib.
1 parent 9d9440e commit 08bac4b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fs/expose/ftp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
import errno
2222
from functools import wraps
2323

24-
from pyftpdlib import ftpserver
24+
from pyftpdlib.authorizers import DummyAuthorizer
25+
from pyftpdlib.filesystems import AbstractedFS
26+
from pyftpdlib.handlers import FTPHandler
27+
from pyftpdlib.servers import FTPServer
2528

2629
from fs.path import *
2730
from fs.osfs import OSFS
@@ -70,7 +73,7 @@ def __init__(self, **kwargs):
7073
setattr(self, attr, value)
7174

7275

73-
class FTPFS(ftpserver.AbstractedFS):
76+
class FTPFS(AbstractedFS):
7477
"""
7578
The basic FTP Filesystem. This is a bridge between a pyfs filesystem and pyftpdlib's
7679
AbstractedFS. This class will cause the FTP server to serve the given fs instance.
@@ -232,7 +235,7 @@ def lexists(self, path):
232235
return True
233236

234237

235-
class FTPFSHandler(ftpserver.FTPHandler):
238+
class FTPFSHandler(FTPHandler):
236239
"""
237240
An FTPHandler class that closes the filesystem when done.
238241
"""
@@ -283,10 +286,9 @@ def serve_fs(fs, addr, port):
283286
Creates a basic anonymous FTP server serving the given FS on the given address/port
284287
combo.
285288
"""
286-
from pyftpdlib.contrib.authorizers import UnixAuthorizer
287289
ftp_handler = FTPFSHandler
288-
ftp_handler.authorizer = ftpserver.DummyAuthorizer()
290+
ftp_handler.authorizer = DummyAuthorizer()
289291
ftp_handler.authorizer.add_anonymous('/')
290292
ftp_handler.abstracted_fs = FTPFSFactory(fs)
291-
s = ftpserver.FTPServer((addr, port), ftp_handler)
293+
s = FTPServer((addr, port), ftp_handler)
292294
s.serve_forever()

0 commit comments

Comments
 (0)