[Zope-Checkins] CVS: Zope/lib/python/OFS - ObjectManager.py:1.163.12.3

Fred L. Drake, Jr. fred at zope.com
Mon Dec 15 17:12:06 EST 2003


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv30776/lib/python/OFS

Modified Files:
      Tag: Zope-2_7-branch
	ObjectManager.py 
Log Message:
- make folder listings for FTP include "." as well as ".."
- fix broken English in the name of a helper function
- minor cleanup and efficiency fix (do not sort file list twice)


=== Zope/lib/python/OFS/ObjectManager.py 1.163.12.2 => 1.163.12.3 ===
--- Zope/lib/python/OFS/ObjectManager.py:1.163.12.2	Mon Nov 17 17:34:07 2003
+++ Zope/lib/python/OFS/ObjectManager.py	Mon Dec 15 17:12:06 2003
@@ -591,17 +591,13 @@
             all_files = copy.copy(files)
             for f in files:
                 if f[1].meta_type == "Folder":
-                    all_files.extend(findChilds(f[1]))
+                    all_files.extend(findChildren(f[1]))
                 else:
                     all_files.append(f)
 
             files = all_files
 
-        try:
-            files.sort()
-        except AttributeError:
-            files=list(files)
-            files.sort()
+        files = list(files)
 
         # Perform globbing on list of files (ajung)
 
@@ -609,15 +605,12 @@
         if globbing :
             files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g) , files)
 
-        try:
-            files.sort()
-        except AttributeError:
-            files=list(files)
-            files.sort()
+        files.sort()
 
         if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
                 self.isTopLevelPrincipiaApplicationObject):
             files.insert(0,('..',self.aq_parent))
+        files.insert(0, ('.', self))
         for k,v in files:
             # Note that we have to tolerate failure here, because
             # Broken objects won't stat correctly. If an object fails
@@ -652,7 +645,6 @@
                 break
         return marshal.dumps((mode,0,0,1,owner,group,0,mtime,mtime,mtime))
 
-
     def __getitem__(self, key):
         v=self._getOb(key, None)
         if v is not None: return v
@@ -663,7 +655,7 @@
                 return NullResource(self, key, request).__of__(self)
         raise KeyError, key
 
-def findChilds(obj,dirname=''):
+def findChildren(obj,dirname=''):
     """ recursive walk through the object hierarchy to
     find all childs of an object (ajung)
     """
@@ -671,7 +663,7 @@
     lst =[]
     for name,child in obj.objectItems():
         if child.meta_type=="Folder":
-            lst.extend(findChilds(child,dirname+ obj.id + '/'))
+            lst.extend(findChildren(child,dirname+ obj.id + '/'))
         else:
             lst.append( (dirname + obj.id + "/" + name,child) )
 




More information about the Zope-Checkins mailing list