[Zope-Checkins] CVS: Zope2 - ObjectManager.py:1.131.2.1

andreas@serenade.digicool.com andreas@serenade.digicool.com
Thu, 29 Mar 2001 14:25:24 -0500


Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade.digicool.com:/tmp/cvs-serv7184/lib/python/OFS

Modified Files:
      Tag: ajung_Zope2_FTP_globbing_patch
	ObjectManager.py 
Log Message:
added globbing functionality to FTP server



--- Updated File ObjectManager.py in package Zope2 --
--- ObjectManager.py	2001/03/29 14:24:20	1.131
+++ ObjectManager.py	2001/03/29 19:25:22	1.131.2.1
@@ -102,7 +102,7 @@
 import App.Common
 from AccessControl import getSecurityManager
 from zLOG import LOG, ERROR
-import sys
+import sys,fnmatch
 
 import XMLExportImport
 customImporters={
@@ -519,7 +519,7 @@
                 'inline;filename=%s.%s' % (id, suffix))
             return f.getvalue()
 
-        f = os.path.join(CLIENT_HOME, '%s.%s' % (id, suffix))
+        f=Globals.data_dir+'/%s.%s' % (id, suffix)
         if toxml:
             XMLExportImport.exportXML(ob._p_jar, ob._p_oid, f)
         else:
@@ -582,6 +582,7 @@
     
     def manage_FTPlist(self, REQUEST):
         "Directory listing for FTP"
+
         out=()
 
         # check to see if we are being acquiring or not
@@ -594,11 +595,19 @@
             ob=ob.aq_parent
         
         files=self.objectItems()
+
         try:
             files.sort()
         except AttributeError:
             files=list(files)
             files.sort()
+
+        # Perform globbing on list of files (ajung)
+           
+        globbing = REQUEST.environ.get('GLOBBING','')
+        if globbing != '':
+            files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g) , files)
+
             
         if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
                 self.isTopLevelPrincipiaApplicationObject):