Log message for revision 67186:
  Fix traversable bug reported by Jordan Baker 
(http://codespeak.net/pipermail/z3-five/2006q2/001309.html)
  

Changed:
  U   Products.Five/branches/1.2/browser/tests/test_traversable.py
  U   Products.Five/branches/1.2/traversable.py

-=-
Modified: Products.Five/branches/1.2/browser/tests/test_traversable.py
===================================================================
--- Products.Five/branches/1.2/browser/tests/test_traversable.py        
2006-04-20 18:06:55 UTC (rev 67185)
+++ Products.Five/branches/1.2/browser/tests/test_traversable.py        
2006-04-20 21:35:51 UTC (rev 67186)
@@ -207,8 +207,8 @@
       ...            xmlns:meta="http://namespaces.zope.org/meta";
       ...            xmlns:browser="http://namespaces.zope.org/browser";
       ...            xmlns:five="http://namespaces.zope.org/five";>
-      ... <!-- make the zope2.Public permission work -->
-      ... <meta:redefinePermission from="zope2.Public" to="zope.Public" />
+      ...   <!-- make the zope2.Public permission work -->
+      ...   <meta:redefinePermission from="zope2.Public" to="zope.Public" />
       ...   <browser:page
       ...       name="eagle"
       ...       for="OFS.interfaces.IObjectManager"
@@ -216,6 +216,7 @@
       ...       attribute="eagle"
       ...       permission="zope2.Public"
       ...       />
+      ...   <five:traversable class="OFS.Application.Application"/>
       ... </configure>'''
       >>> import Products.Five
       >>> from Products.Five import zcml
@@ -252,13 +253,32 @@
       The eagle has landed
 
 
+    Some weird implementations of __bobo_traverse__, like the one
+    found in OFS.Application, raise NotFound.  Five still knows how to
+    deal with this, hence views work there too:
+
+      >>> print http(r'''
+      ... GET /eagle HTTP/1.1
+      ...
+      ... ''')
+      HTTP/1.1 200 OK
+      ...
+      The eagle has landed
+
+      >>> print http(r'''
+      ... GET /@@eagle HTTP/1.1
+      ...
+      ... ''')
+      HTTP/1.1 200 OK
+      ...
+      The eagle has landed
+
     Clean up:
 
       >>> from zope.app.tests.placelesssetup import tearDown
       >>> tearDown()
     """
 
-
 def test_suite():
     from Testing.ZopeTestCase import FunctionalDocTestSuite
     return FunctionalDocTestSuite()

Modified: Products.Five/branches/1.2/traversable.py
===================================================================
--- Products.Five/branches/1.2/traversable.py   2006-04-20 18:06:55 UTC (rev 
67185)
+++ Products.Five/branches/1.2/traversable.py   2006-04-20 21:35:51 UTC (rev 
67186)
@@ -63,6 +63,14 @@
                 return self.__fallback_traverse__(REQUEST, name)
             except (AttributeError, KeyError):
                 pass
+            except NotFound:
+                # OFS.Application.__bobo_traverse__ calls
+                # REQUEST.RESPONSE.notFoundError which sets the HTTP
+                # status code to 404
+                try:
+                    REQUEST.RESPONSE.setStatus(200)
+                except AttributeError:
+                    pass
         else:
             try:
                 return getattr(self, name)

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to