[Zope-Checkins] CVS: Zope2 - FTPRequest.py:1.9.10.4 FTPServer.py:1.16.2.3

Andreas Jung andreas@dhcp165.digicool.com
Fri, 30 Mar 2001 16:26:51 -0500


Update of /cvs-repository/Zope2/ZServer
In directory yetix:/work/zope/Zope2/Zope2/ZServer

Modified Files:
      Tag: ajung_Zope2_FTP_globbing_patch
	FTPRequest.py FTPServer.py 
Log Message:
added support for recursive file listings (ls -R) on the FTP server



--- Updated File FTPRequest.py in package Zope2 --
--- FTPRequest.py	2001/03/30 16:12:37	1.9.10.3
+++ FTPRequest.py	2001/03/30 21:26:18	1.9.10.4
@@ -100,12 +100,13 @@
 class FTPRequest(HTTPRequest):
 
     def __init__(self, path, command, channel, response, stdin=None,
-                 environ=None,globbing=None):
+                 environ=None,globbing=None,recursive=0):
 
         # we need to store the globbing information to pass it
         # to the ZPublisher and the manage_FTPlist function 
         # (ajung)
         self.globbing = globbing
+        self.recursive= recursive
         
         if stdin is None: stdin=StringIO()
         if environ is None:
@@ -184,6 +185,7 @@
 
         # Fake in globbing information 
         env['GLOBBING'] = self.globbing
+        env['FTP_RECURSIVE'] = self.recursive
 
         return env
     

--- Updated File FTPServer.py in package Zope2 --
--- FTPServer.py	2001/03/30 15:51:49	1.16.2.2
+++ FTPServer.py	2001/03/30 21:26:18	1.16.2.3
@@ -203,8 +203,10 @@
     
     def get_dir_list(self, line, long=0):
         self.globbing = None
+        self.recursive = 0
         # we need to scan the command line for arguments to '/bin/ls'...
         # XXX clean this up, maybe with getopts
+
         if len(line) > 1:
             args = string.split(line[1])
         else:
@@ -212,7 +214,8 @@
         path_args = []
 
         # Extract globbing information 
-        # 
+
+       
         for i in range(len(args)):
             x = args[i]
             if string.find(x,'*')!=-1 or string.find(x,'?')!=-1:
@@ -225,9 +228,10 @@
             else:
                 if 'l' in arg:
                     long=1
+                if 'R' in arg:
+                    self.recursive = 1
 
         if len(path_args) < 1:
-       
             dir = '.'
         else:
             dir = path_args[0]
@@ -236,7 +240,7 @@
     
     def listdir (self, path, long=0):
         response=make_response(self, self.listdir_completion, long)
-        request=FTPRequest(path, 'LST', self, response,globbing=self.globbing)
+        request=FTPRequest(path, 'LST', self, response,globbing=self.globbing,recursive=self.recursive)
         handle(self.module, request, response)         
         
     def listdir_completion(self, long, response):