[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/FTP - FTPServer.py:1.1.2.9 FTPServerChannel.py:1.1.2.15

Stephan Richter srichter@cbu.edu
Sat, 6 Apr 2002 14:57:40 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Server/FTP
In directory cvs.zope.org:/tmp/cvs-serv2221

Modified Files:
      Tag: Zope3-Server-Branch
	FTPServer.py FTPServerChannel.py 
Log Message:
Started writing FTP Server tests. Some are fairly easy, but othere are
hard, since FTP opens other connections as well.


=== Zope3/lib/python/Zope/Server/FTP/FTPServer.py 1.1.2.8 => 1.1.2.9 ===
     """Generic FTP Server"""
 
-    filesystem = UnixFileSystem('/')
-    auth_source = DictionaryAuthentication({'foo': 'bar'})
-
     channel_class = FTPServerChannel
     SERVER_IDENT = 'Zope.Server.FTPServer'
 
 
-    def __init__(self, ip, port, task_dispatcher=None, adj=None, start=1,
-                 hit_log=None, verbose=0, socket_map=None):
+    def __init__(self, ip, port, dir='/', auth_source=None,
+                 task_dispatcher=None, adj=None, start=1, hit_log=None,
+                 verbose=0, socket_map=None):
+
+        self.filesystem = UnixFileSystem(dir)
+        self.auth_source = auth_source
+
         super(FTPServer, self).__init__(ip, port, task_dispatcher,
                                         adj, start, hit_log,
                                         verbose, socket_map)
@@ -54,7 +56,8 @@
     from Zope.Server.TaskThreads import ThreadedTaskDispatcher
     td = ThreadedTaskDispatcher()
     td.setThreadCount(4)
-    FTPServer('', 8021, task_dispatcher=td)
+    auth_source = DictionaryAuthentication({'foo': 'bar'})
+    FTPServer('', 8021, '/', auth_source, task_dispatcher=td)
     try:
         while 1:
             asyncore.poll(5)


=== Zope3/lib/python/Zope/Server/FTP/FTPServerChannel.py 1.1.2.14 => 1.1.2.15 ===
 
     # List of commands that are always available
-    special_commands = ('cmd_quit', 'cmd_user', 'cmd_pass')
+    special_commands = ('cmd_quit', 'cmd_type', 'cmd_noop', 'cmd_user',
+                        'cmd_pass')
 
     # These are the commands that are accessing the filesystem.
     # Since this could be also potentially a longer process, these commands
@@ -95,7 +96,7 @@
         'See Zope.Server.FTP.IFTPCommandHandler.IFTPCommandHandler'
         if self.client_dc:
             self.client_dc.close()
-        self.reply('TRANS_SUCCESS', 'ABOR')
+        self.reply('TRANSFER_ABORTED')
 
 
     def cmd_appe (self, args):
@@ -396,9 +397,7 @@
                     buffer.skip(len(data), 1)
                     outfile.write(data)
             finally:
-                print 'cp4'
                 outfile.close()
-                print 'cp5'
         except IOError, why:
             self.reply('ERR_OPEN_WRITE', str(why))
             return