[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/FTP - PublisherFilesystemAccess.py:1.1.2.1 FTPServer.py:1.1.2.12 FTPServerChannel.py:1.1.2.22 PublisherFTPServer.py:1.1.2.7 UsernamePassword.py:NONE
Stephan Richter
srichter@cbu.edu
Thu, 11 Apr 2002 00:32:41 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Server/FTP
In directory cvs.zope.org:/tmp/cvs-serv25892/lib/python/Zope/Server/FTP
Modified Files:
Tag: Zope3-Server-Branch
FTPServer.py FTPServerChannel.py PublisherFTPServer.py
Added Files:
Tag: Zope3-Server-Branch
PublisherFilesystemAccess.py
Removed Files:
Tag: Zope3-Server-Branch
UsernamePassword.py
Log Message:
Wee, quiet a bit of changes, but they fix and finnish the stuff Shane did
earlier today.
- Removed a lot of old files and moved some to more appropriate places. The
removal of the Suthentication directory is probably the biggest one. I
also deleted all the other FileSystem types, like MSDOS and Unix, since
the FielSystem is not returning formatted lists anymore. Yipee!
- Fixed PublisherFTPServer, so it works with Shane's new Credentials
interfaces. Everything should be working fine again.
- Fixed the POP3 and SMTP code to work with the new model. It all works
really well. I hope that Gerson Kurz will take over this development
soon. I also contacted authors of other server protocols, and they might
join. Rich Salz is already writing a method for ZSI, so that we can
insert SOAP in the next days.
- Made most tests run again and updated them. I still have one error. I know
why it is caused, but I do not know how to correct. I know it is a test
environment problem though, not a code one.
=== Added File Zope3/lib/python/Zope/Server/FTP/PublisherFilesystemAccess.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Implementation of IFilesystemAccess intended only for testing.
$Id: PublisherFilesystemAccess.py,v 1.1.2.1 2002/04/11 04:32:09 srichter Exp $
"""
from cStringIO import StringIO
from Zope.Exceptions import Unauthorized
from Zope.App.Security.PrincipalRegistry import principalRegistry
from Zope.Server.VFS.PublisherFileSystem import PublisherFileSystem
from Zope.Server.VFS.IFilesystemAccess import IFilesystemAccess
from Zope.Server.VFS.IUsernamePassword import IUsernamePassword
class PublisherFilesystemAccess:
__implements__ = IFilesystemAccess
def __init__(self, request_factory):
self.request_factory = request_factory
def authenticate(self, credentials):
assert IUsernamePassword.isImplementedBy(credentials)
env = {'credentials' : credentials}
request = self.request_factory(StringIO(''), StringIO(), env)
id = principalRegistry.authenticate(request)
if id is None:
raise Unauthorized
def open(self, credentials):
return PublisherFileSystem(credentials, self.request_factory)
=== Zope3/lib/python/Zope/Server/FTP/FTPServer.py 1.1.2.11 => 1.1.2.12 ===
"""
import asyncore
-import pwd
from FTPServerChannel import FTPServerChannel
from Zope.Server.ServerBase import ServerBase
from Zope.Server.VFS.IFilesystemAccess import IFilesystemAccess
@@ -41,7 +40,7 @@
if __name__ == '__main__':
from Zope.Server.TaskThreads import ThreadedTaskDispatcher
from Zope.Server.VFS.OSFileSystem import OSFileSystem
- from TestFilesystemAccess import TestFilesystemAccess
+ from Zope.Server.VFS.TestFilesystemAccess import TestFilesystemAccess
td = ThreadedTaskDispatcher()
td.setThreadCount(4)
fs = OSFileSystem('/')
=== Zope3/lib/python/Zope/Server/FTP/FTPServerChannel.py 1.1.2.21 => 1.1.2.22 ===
from RecvChannel import RecvChannel
from XmitChannel import XmitChannel, ApplicationXmitStream
-from UsernamePassword import UsernamePassword
+from Zope.Server.VFS.UsernamePassword import UsernamePassword
from Zope.Exceptions import Unauthorized
@@ -461,9 +461,7 @@
path = args
else:
path = os.path.join(self.cwd, args)
- # Note: don't use os.path.normpath() here! Otherwise Zope won't
- # work on case-insensitive platforms.
- return path
+ return self._getFilesystem().normalize(path)
def newPassiveAcceptor(self):
=== Zope3/lib/python/Zope/Server/FTP/PublisherFTPServer.py 1.1.2.6 => 1.1.2.7 ===
$Id$
"""
-from PublisherFTPServerChannel import PublisherFTPServerChannel
-from Zope.Server.ServerBase import ServerBase
+from FTPServer import FTPServer
-from Zope.Server.VFS.PublisherFileSystem import PublisherFileSystem
+from Zope.Server.FTP.PublisherFilesystemAccess import PublisherFilesystemAccess
-
-class PublisherFileSystemOpener:
- """ """
-
- filesystem_factory = PublisherFileSystem
-
-
- def __init__(self, root_dir, request_factory):
- self.root_dir = root_dir
- self.filesystem_factory.request_factory = request_factory
-
-
- def __call__(self, username, password):
- return PublisherFileSystem(self.root_dir, username, password)
-
-
-
-class PublisherFTPServer(ServerBase):
+class PublisherFTPServer(FTPServer):
"""Generic FTP Server"""
- channel_class = PublisherFTPServerChannel
- SERVER_IDENT = 'Zope.Server.FTPServer'
-
-
- def __init__(self, request_factory, name, ip, port,
- task_dispatcher=None, adj=None, start=1, hit_log=None,
- verbose=0):
+ def __init__(self, request_factory, name, ip, port, *args, **kw):
self.request_factory = request_factory
- self.openFilesystem = PublisherFileSystemOpener('/', request_factory)
-
- super(PublisherFTPServer, self).__init__(ip, port, task_dispatcher,
- adj, start, hit_log,
- verbose)
+ fs_access = PublisherFilesystemAccess(request_factory)
+ super(PublisherFTPServer, self).__init__(ip, port, fs_access,
+ *args, **kw)
=== Removed File Zope3/lib/python/Zope/Server/FTP/UsernamePassword.py ===