[Zope-Checkins] CVS: Zope2 - FTPRequest.py:1.9.10.1 FTPServer.py:1.16.2.1
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Thu, 29 Mar 2001 14:25:24 -0500
Update of /cvs-repository/Zope2/ZServer
In directory serenade.digicool.com:/tmp/cvs-serv7184/ZServer
Modified Files:
Tag: ajung_Zope2_FTP_globbing_patch
FTPRequest.py FTPServer.py
Log Message:
added globbing functionality to FTP server
--- Updated File FTPRequest.py in package Zope2 --
--- FTPRequest.py 2001/01/23 20:06:41 1.9
+++ FTPRequest.py 2001/03/29 19:25:21 1.9.10.1
@@ -100,10 +100,17 @@
class FTPRequest(HTTPRequest):
def __init__(self, path, command, channel, response, stdin=None,
- environ=None):
+ environ=None,globbing=''):
+
+ # we need to store the globbing information to pass it
+ # to the ZPublisher and the manage_FTPlist function
+ # (ajung)
+ self.globbing = globbing
+
if stdin is None: stdin=StringIO()
if environ is None:
environ=self._get_env(path, command, channel, stdin)
+
self._orig_env=environ
HTTPRequest.__init__(self, stdin, environ, response, clean=1)
@@ -174,6 +181,10 @@
env['CONTENT_LENGTH']=len(stdin.getvalue())
else:
env['PATH_INFO']=self._join_paths(channel.path, path, command)
+
+ # Fake in globbing information
+ env['GLOBBING'] = self.globbing
+
return env
def _join_paths(self,*args):
--- Updated File FTPServer.py in package Zope2 --
--- FTPServer.py 2001/03/27 03:10:21 1.16
+++ FTPServer.py 2001/03/29 19:25:22 1.16.2.1
@@ -202,6 +202,7 @@
self.get_dir_list(line,1)
def get_dir_list(self, line, long=0):
+ self.globbing = ''
# we need to scan the command line for arguments to '/bin/ls'...
# XXX clean this up, maybe with getopts
if len(line) > 1:
@@ -209,21 +210,33 @@
else:
args =[]
path_args = []
+
+ # Extract globbing information
+ #
+ for i in range(len(args)):
+ x = args[i]
+ if string.find(x,'*')!=-1 or string.find(x,'?')!=-1:
+ self.globbing = x
+ args[i] = '.'
+
for arg in args:
if arg[0] != '-':
path_args.append (arg)
else:
if 'l' in arg:
long=1
+
if len(path_args) < 1:
+
dir = '.'
else:
dir = path_args[0]
+
self.listdir(dir, long)
def listdir (self, path, long=0):
response=make_response(self, self.listdir_completion, long)
- request=FTPRequest(path, 'LST', self, response)
+ request=FTPRequest(path, 'LST', self, response,globbing=self.globbing)
handle(self.module, request, response)
def listdir_completion(self, long, response):