[Zope-Checkins] SVN: Products.Five/branches/1.4/ Merge r67186 from 1.2 branch:

Philipp von Weitershausen philikon at philikon.de
Thu Apr 20 18:02:16 EDT 2006


Log message for revision 67192:
  Merge r67186 from 1.2 branch:
    Fix traversable bug reported by Jordan Baker (http://codespeak.net/pipermail/z3-five/2006q2/001309.html)
  

Changed:
  U   Products.Five/branches/1.4/CHANGES.txt
  U   Products.Five/branches/1.4/browser/tests/test_traversable.py
  U   Products.Five/branches/1.4/traversable.py

-=-
Modified: Products.Five/branches/1.4/CHANGES.txt
===================================================================
--- Products.Five/branches/1.4/CHANGES.txt	2006-04-20 21:51:33 UTC (rev 67191)
+++ Products.Five/branches/1.4/CHANGES.txt	2006-04-20 22:02:15 UTC (rev 67192)
@@ -2,12 +2,18 @@
 Five Changes
 ============
 
-Five 1.4.0 (unreleased)
-=======================
+Five 1.4 (unreleased)
+=====================
 
-* Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of
-  xx_YY or xx-YY.
+Bugfixes
+--------
 
+* Made sure LocalizerLanguages class normalized language codes to
+  xx-yy, instead of xx_YY or xx-YY.
+
+* Fixed a problem with the new traversal look-up order and the root
+  object (OFS.Application.Application).
+
 Five 1.4b (2006-03-31)
 ======================
 

Modified: Products.Five/branches/1.4/browser/tests/test_traversable.py
===================================================================
--- Products.Five/branches/1.4/browser/tests/test_traversable.py	2006-04-20 21:51:33 UTC (rev 67191)
+++ Products.Five/branches/1.4/browser/tests/test_traversable.py	2006-04-20 22:02:15 UTC (rev 67192)
@@ -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.testing.placelesssetup import tearDown
       >>> tearDown()
     """
 
-
 def test_suite():
     from Testing.ZopeTestCase import FunctionalDocTestSuite
     return FunctionalDocTestSuite()

Modified: Products.Five/branches/1.4/traversable.py
===================================================================
--- Products.Five/branches/1.4/traversable.py	2006-04-20 21:51:33 UTC (rev 67191)
+++ Products.Five/branches/1.4/traversable.py	2006-04-20 22:02:15 UTC (rev 67192)
@@ -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)



More information about the Zope-Checkins mailing list