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

chrism@serenade.digicool.com chrism@serenade.digicool.com
Mon, 9 Apr 2001 14:23:41 -0400


Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade.digicool.com:/home/chrism/sandboxes/DAVFTPMerge/lib/python/OFS

Modified Files:
      Tag: zope-2_3-branch
	ObjectManager.py 
Log Message:
Unding changes from FTP merge.



--- Updated File ObjectManager.py in package Zope2 --
--- ObjectManager.py	2001/04/09 18:09:45	1.121.4.15
+++ ObjectManager.py	2001/04/09 18:23:40	1.121.4.16
@@ -102,16 +102,14 @@
 import App.Common
 from AccessControl import getSecurityManager
 from zLOG import LOG, ERROR
-import string
-import sys,fnmatch,copy
-import translationset
+import sys
 
 import XMLExportImport
 customImporters={
     XMLExportImport.magic: XMLExportImport.importXML,
     }
 
-bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\. ]' ).search # TS
+bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\. ]').search #TS
 
 # Global constants: __replaceable__ flags:
 NOT_REPLACEABLE = 0
@@ -271,10 +269,8 @@
         return default
 
     def _setObject(self,id,object,roles=None,user=None, set_owner=1):
-
         v=self._checkId(id)
         if v is not None: id=v
- 
         try:    t=object.meta_type
         except: t=None
 
@@ -587,7 +583,6 @@
     
     def manage_FTPlist(self, REQUEST):
         "Directory listing for FTP"
-
         out=()
 
         # check to see if we are being acquiring or not
@@ -600,32 +595,11 @@
             ob=ob.aq_parent
         
         files=self.objectItems()
-
-        # recursive ride through all subfolders (ls -R) (ajung)
-
-        if REQUEST.environ.get('FTP_RECURSIVE',0) == 1:
-
-            all_files = copy.copy(files)
-            for f in files:
-                if f[1].meta_type == "Folder":
-                    all_files.extend(findChilds(f[1]))
-                else:
-                    all_files.append(f)
-            
-            files = all_files
-
         try:
             files.sort()
         except AttributeError:
             files=list(files)
             files.sort()
-
-        # Perform globbing on list of files (ajung)
-           
-        globbing = REQUEST.environ.get('GLOBBING','')
-        if globbing is not None:
-            files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g) , files)
-
             
         if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
                 self.isTopLevelPrincipiaApplicationObject):
@@ -634,11 +608,10 @@
             # Note that we have to tolerate failure here, because
             # Broken objects won't stat correctly. If an object fails
             # to be able to stat itself, we will ignore it.
-            try:   stat=marshal.loads(v.manage_FTPstat(REQUEST))
+            try:    stat=marshal.loads(v.manage_FTPstat(REQUEST))
             except: stat=None
             if stat is not None:
                 out=out+((k,stat),)
-
         return marshal.dumps(out)   
 
     def manage_FTPstat(self,REQUEST):
@@ -661,11 +634,8 @@
         owner=group='Zope'
         for user, roles in self.get_local_roles():
             if 'Owner' in roles:
-                # We remove spaces from the username because breaks
-                # the directory listing of some scrubby FTP clients (ajung)
-                owner = string.replace(user," ","")
+                owner=user
                 break
-        
         return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
 
 
@@ -678,21 +648,6 @@
             if request.maybe_webdav_client and not method in ('GET', 'POST'):
                 return NullResource(self, key, request).__of__(self)
         raise KeyError, key
-
-
-def findChilds(obj,dirname=''):
-    """ recursive walk through the object hierarcy to
-    find all childs of an object (ajung)
-    """
-
-    lst =[] 
-    for name,child in obj.objectItems():
-        if child.meta_type=="Folder":
-            lst.extend(findChilds(child,dirname+ obj.id + '/'))
-        else:
-            lst.append( (dirname + obj.id + "/" + name,child) )
-
-    return lst
 
 
 Globals.default__class_init__(ObjectManager)