[Zope-Checkins] SVN: Zope/trunk/ Remove unused local assignment

Casey Duncan casey at zope.com
Thu Jun 3 10:07:01 EDT 2004


Log message for revision 25228:
Remove unused local assignment
Add test for upward traversal



-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-06-03 14:05:08 UTC (rev 25227)
+++ Zope/trunk/doc/CHANGES.txt	2004-06-03 14:07:00 UTC (rev 25228)
@@ -121,6 +121,9 @@
        is now installed into the 'bin' folder.
 
     Bugs fixed
+    
+     - unrestrictedTraverse() refactored to remove hasattr calls (which mask
+       conflict errors) and for greater readability and maintainability.
 
      - Zope can now be embedded in C/C++ without exceptions being raised
        in zdoptions.

Modified: Zope/trunk/lib/python/OFS/Traversable.py
===================================================================
--- Zope/trunk/lib/python/OFS/Traversable.py	2004-06-03 14:05:08 UTC (rev 25227)
+++ Zope/trunk/lib/python/OFS/Traversable.py	2004-06-03 14:07:00 UTC (rev 25228)
@@ -127,7 +127,6 @@
             return self
         
         _getattr = getattr
-        _hasattr = hasattr
         _none = None
         marker = _marker
 

Modified: Zope/trunk/lib/python/OFS/tests/testTraverse.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testTraverse.py	2004-06-03 14:05:08 UTC (rev 25227)
+++ Zope/trunk/lib/python/OFS/tests/testTraverse.py	2004-06-03 14:07:00 UTC (rev 25228)
@@ -255,6 +255,12 @@
         SecurityManager.setSecurityPolicy( self.oldPolicy )
         self.assertEqual(
             self.root.restrictedTraverse('happy/happy', 'joy'), 'joy')
+            
+    def testTraverseUp(self):
+        # Test that we can traverse upwards
+        self.failUnless(
+            aq_base(self.root.folder1.file.restrictedTraverse('../..')) is
+            aq_base(self.root))
 
 
 def test_suite():




More information about the Zope-Checkins mailing list