[Zope3-checkins] SVN: Zope3/branches/3.3/ - fixed issue 575: inconsistent raising of TraversalError

Christian Theune cvs-admin at zope.org
Sun Jun 18 18:49:07 EDT 2006


Log message for revision 68737:
   - fixed issue 575: inconsistent raising of TraversalError
  

Changed:
  U   Zope3/branches/3.3/doc/CHANGES.txt
  U   Zope3/branches/3.3/src/zope/app/container/traversal.py
  U   Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py
  U   Zope3/branches/3.3/src/zope/app/schema/browser/traversal.py
  U   Zope3/branches/3.3/src/zope/traversing/namespace.py
  U   Zope3/branches/3.3/src/zwiki/traversal.py

-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt	2006-06-18 18:04:33 UTC (rev 68736)
+++ Zope3/branches/3.3/doc/CHANGES.txt	2006-06-18 22:49:03 UTC (rev 68737)
@@ -10,6 +10,8 @@
 
     Bugfixes
 
+      - Fixed issue 575: Inconsistent raising of TraversalError
+
       - Fixed issue 592: Made handling of '(no value)' entries for selection
         widgets cleaner and consistent
 

Modified: Zope3/branches/3.3/src/zope/app/container/traversal.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/container/traversal.py	2006-06-18 18:04:33 UTC (rev 68736)
+++ Zope3/branches/3.3/src/zope/app/container/traversal.py	2006-06-18 22:49:03 UTC (rev 68737)
@@ -97,6 +97,6 @@
         if v is _marker:
             v = getattr(container, name, _marker)
             if v is _marker:
-                raise TraversalError(name)
+                raise TraversalError(container, name)
 
         return v

Modified: Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py	2006-06-18 18:04:33 UTC (rev 68736)
+++ Zope3/branches/3.3/src/zope/app/pagetemplate/engine.py	2006-06-18 22:49:03 UTC (rev 68737)
@@ -375,7 +375,7 @@
         try:
             return self[name]
         except KeyError:
-            raise TraversalError(name)
+            raise TraversalError(self, name)
 
 
 def _Engine(engine=None):

Modified: Zope3/branches/3.3/src/zope/app/schema/browser/traversal.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/schema/browser/traversal.py	2006-06-18 18:04:33 UTC (rev 68736)
+++ Zope3/branches/3.3/src/zope/app/schema/browser/traversal.py	2006-06-18 22:49:03 UTC (rev 68737)
@@ -69,6 +69,6 @@
     def traverse(self, name, furtherPath):
         subobj = self._context.get(name, _marker)
         if subobj is _marker:
-            raise TraversalError(name)
+            raise TraversalError(self._context, name)
 
         return subobj

Modified: Zope3/branches/3.3/src/zope/traversing/namespace.py
===================================================================
--- Zope3/branches/3.3/src/zope/traversing/namespace.py	2006-06-18 18:04:33 UTC (rev 68736)
+++ Zope3/branches/3.3/src/zope/traversing/namespace.py	2006-06-18 22:49:03 UTC (rev 68737)
@@ -65,19 +65,19 @@
 
     If we give an invalid namespace, we'll get a not found error:
 
-      >>> namespaceLookup('fiz', 'bar', C())
+      >>> namespaceLookup('fiz', 'bar', C())    # doctest: +ELLIPSIS
       Traceback (most recent call last):
       ...
-      TraversalError: '++fiz++bar'
+      TraversalError: (<zope.traversing.namespace.C object at 0x...>, '++fiz++bar')
 
     We'll get the same thing if we provide a request:
 
       >>> from zope.publisher.browser import TestRequest
       >>> request = TestRequest()
-      >>> namespaceLookup('foo', 'bar', C(), request)
+      >>> namespaceLookup('foo', 'bar', C(), request)    # doctest: +ELLIPSIS
       Traceback (most recent call last):
       ...
-      TraversalError: '++foo++bar'
+      TraversalError: (<zope.traversing.namespace.C object at 0x...>, '++foo++bar')
 
     We need to provide a view:
 
@@ -104,7 +104,7 @@
         traverser = zope.component.queryAdapter(object, ITraversable, ns)
 
     if traverser is None:
-        raise TraversalError("++%s++%s" % (ns, name))
+        raise TraversalError(object, "++%s++%s" % (ns, name))
 
     return traverser.traverse(name, ())
 
@@ -205,7 +205,7 @@
           ...     def traverse(self, name, remaining):
           ...         v = getattr(self, name, None)
           ...         if v is None:
-          ...             raise TraversalError(name)
+          ...             raise TraversalError(self, name)
           ...         return v
           ...     def __repr__(self):
           ...         return 'splat'

Modified: Zope3/branches/3.3/src/zwiki/traversal.py
===================================================================
--- Zope3/branches/3.3/src/zwiki/traversal.py	2006-06-18 18:04:33 UTC (rev 68736)
+++ Zope3/branches/3.3/src/zwiki/traversal.py	2006-06-18 22:49:03 UTC (rev 68737)
@@ -75,6 +75,6 @@
         if subobj is _marker:
             subobj = getattr(self._page, name, _marker)
             if subobj is _marker:
-                raise TraversalError(name)
+                raise TraversalError(self._page, name)
 
         return subobj



More information about the Zope3-Checkins mailing list