[Zope-Checkins] SVN: Zope/trunk/ - Collector #2002: fixed broken 'ls -R' functionality (didn't

Sidnei da Silva sidnei at enfoldsystems.com
Sat Jan 21 09:24:59 EST 2006


Log message for revision 41395:
  
        - Collector #2002: fixed broken 'ls -R' functionality (didn't
          recurse properly subclasses of OFS.Folder)
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/OFS/ObjectManager.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2006-01-21 14:23:00 UTC (rev 41394)
+++ Zope/trunk/doc/CHANGES.txt	2006-01-21 14:24:58 UTC (rev 41395)
@@ -197,6 +197,9 @@
 
     Bugs Fixed
 
+      - Collector #2002: fixed broken 'ls -R' functionality (didn't
+        recurse properly subclasses of OFS.Folder)
+
       - Collector #1992: unified the visible hostnames of the FTP and
         HTTP servers
 
@@ -208,7 +211,6 @@
         as specified through the 'charset' within the content-type
         property.
 
-
       - Collector #1939: When running as a service, Zope could
         potentially collect too much log output filling the NT Event
         Log. When that happened, a 'print' during exception handling

Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/ObjectManager.py	2006-01-21 14:23:00 UTC (rev 41394)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py	2006-01-21 14:24:58 UTC (rev 41395)
@@ -527,7 +527,7 @@
             obj_ids.sort()
             for id in obj_ids:
                 o=self._getOb(id)
-                if hasattr(o, 'isPrincipiaFolderish') and \
+                if hasattr(aq_base(o), 'isPrincipiaFolderish') and \
                    o.isPrincipiaFolderish:
                     r.append(o)
         return r
@@ -648,7 +648,7 @@
                 break
             ob=ob.aq_parent
 
-        files=self.objectItems()
+        files = list(self.objectItems())
 
         # recursive ride through all subfolders (ls -R) (ajung)
 
@@ -656,15 +656,10 @@
 
             all_files = copy.copy(files)
             for f in files:
-                if f[1].meta_type == "Folder":
+                if hasattr(aq_base(f[1]), 'isPrincipiaFolderish') and f[1].isPrincipiaFolderish:
                     all_files.extend(findChildren(f[1]))
-                else:
-                    all_files.append(f)
-
             files = all_files
 
-        files = list(files)
-
         # Perform globbing on list of files (ajung)
 
         globbing = REQUEST.environ.get('GLOBBING','')
@@ -746,12 +741,12 @@
     find all children of an object (ajung)
     """
 
-    lst =[]
-    for name,child in obj.objectItems():
-        if child.meta_type=="Folder":
-            lst.extend(findChildren(child,dirname+ obj.id + '/'))
+    lst = []
+    for name, child in obj.objectItems():
+        if hasattr(aq_base(child), 'isPrincipiaFolderish') and child.isPrincipiaFolderish:
+            lst.extend(findChildren(child, dirname + obj.id + '/'))
         else:
-            lst.append( (dirname + obj.id + "/" + name,child) )
+            lst.append((dirname + obj.id + "/" + name, child))
 
     return lst
 



More information about the Zope-Checkins mailing list