Skip to content

Use the last API of pyftpdlib #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions fs/expose/ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import errno
from functools import wraps

from pyftpdlib import ftpserver
from pyftpdlib import filesystems, servers, handlers

from fs.path import *
from fs.osfs import OSFS
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(self, **kwargs):
setattr(self, attr, value)


class FTPFS(ftpserver.AbstractedFS):
class FTPFS(filesystems.AbstractedFS):
"""
The basic FTP Filesystem. This is a bridge between a pyfs filesystem and pyftpdlib's
AbstractedFS. This class will cause the FTP server to serve the given fs instance.
Expand Down Expand Up @@ -232,7 +232,7 @@ def lexists(self, path):
return True


class FTPFSHandler(ftpserver.FTPHandler):
class FTPFSHandler(handlers.FTPHandler):
"""
An FTPHandler class that closes the filesystem when done.
"""
Expand Down Expand Up @@ -283,10 +283,10 @@ def serve_fs(fs, addr, port):
Creates a basic anonymous FTP server serving the given FS on the given address/port
combo.
"""
from pyftpdlib.contrib.authorizers import UnixAuthorizer
from pyftpdlib.authorizers import UnixAuthorizer
ftp_handler = FTPFSHandler
ftp_handler.authorizer = ftpserver.DummyAuthorizer()
ftp_handler.authorizer = handlers.DummyAuthorizer()
ftp_handler.authorizer.add_anonymous('/')
ftp_handler.abstracted_fs = FTPFSFactory(fs)
s = ftpserver.FTPServer((addr, port), ftp_handler)
s = servers.FTPServer((addr, port), ftp_handler)
s.serve_forever()