[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.8

Shane Hathaway shane@cvs.zope.org
Thu, 6 Jun 2002 11:08:23 -0400


Update of /cvs-repository/Products/BTreeFolder2
In directory cvs.zope.org:/tmp/cvs-serv25674

Modified Files:
	BTreeFolder2.py 
Log Message:
Boo hoo hoo!  Zope 2 prefers implicit acquisition over traversal
to subitems, and I can't add a __bobo_traverse__ hook, since it
makes restrictedTraverse() choke.  __getattr__() is our only hope.


=== Products/BTreeFolder2/BTreeFolder2.py 1.7 => 1.8 ===
         return id
 
+    def __getattr__(self, name):
+        # Boo hoo hoo!  Zope 2 prefers implicit acquisition over traversal
+        # to subitems, and __bobo_traverse__ hooks don't work with
+        # restrictedTraverse() unless __getattr__() is also present.
+        # Oh well.
+        res = self._tree.get(name)
+        if res is None:
+            raise AttributeError, name
+        return res
+
 
 Globals.InitializeClass(BTreeFolder2Base)