[Zope-Checkins] CVS: Zope/lib/python/OFS - FindSupport.py:1.26

Brian Lloyd brian@digicool.com
Tue, 25 Sep 2001 11:16:54 -0400


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

Modified Files:
	FindSupport.py 
Log Message:
merged find in zclass fix from 2.4 branch

=== Zope/lib/python/OFS/FindSupport.py 1.25 => 1.26 ===
             base=obj.aq_base
 
-        if not hasattr(base, 'objectItems'):
-            return result
-        try:    items=obj.objectItems()
-        except: return result
+        if hasattr(base, 'objectItems'):
+	    try:    items=obj.objectItems()
+	    except: return result
+        else:
+            if getattr(base, 'meta_type', None) == 'Z Class':
+		try:    items=obj.propertysheets.methods.objectItems()
+		except: return result
+            else:
+		return result
 
         try: add_result=result.append
         except:
@@ -194,14 +199,21 @@
                 ):
                 add_result((p, ob))
                 dflag=0
-                    
-            if search_sub and hasattr(bs, 'objectItems'):
-                self.ZopeFind(ob, obj_ids, obj_metatypes,
+
+            is_zclass = getattr(bs, 'meta_type', None) == 'Z Class'
+            if search_sub and (hasattr(bs, 'objectItems') or is_zclass):
+                if is_zclass:
+                    subob = ob.propertysheets.methods
+                    sub_p = '%s/propertysheets/methods' % p
+                else:
+                    subob = ob
+                    sub_p = p
+                self.ZopeFind(subob, obj_ids, obj_metatypes,
                                    obj_searchterm, obj_expr,
                                    obj_mtime, obj_mspec,
                                    obj_permission, obj_roles,
                                    search_sub,
-                                   REQUEST, result, p)
+                                   REQUEST, result, sub_p)
             if dflag: ob._p_deactivate()
 
         return result