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

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


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

Modified Files:
	ObjectManager.py 
Log Message:
Make folder listings for FTP include "." as well as "..".


=== Zope/lib/python/OFS/ObjectManager.py 1.166 => 1.167 ===
--- Zope/lib/python/OFS/ObjectManager.py:1.166	Fri Nov 28 11:45:35 2003
+++ Zope/lib/python/OFS/ObjectManager.py	Mon Dec 15 17:09:25 2003
@@ -592,7 +592,7 @@
             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)
 
@@ -608,7 +608,7 @@
 
         globbing = REQUEST.environ.get('GLOBBING','')
         if globbing :
-            files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g) , files)
+            files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g), files)
 
         try:
             files.sort()
@@ -619,12 +619,17 @@
         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
             # to be able to stat itself, we will ignore it.
             try:    stat=marshal.loads(v.manage_FTPstat(REQUEST))
-            except: stat=None
+            except:
+                stat=None
+                if k != "Control_Panel":
+                    __traceback_info__ = (k, v)
+                    raise
             if stat is not None:
                 out=out+((k,stat),)
         return marshal.dumps(out)
@@ -667,15 +672,15 @@
                 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)
+    find all children of an object (ajung)
     """
 
     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