[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - DefaultPublication.py:1.1.2.9.4.2

Jim Fulton jim@zope.com
Tue, 26 Mar 2002 11:55:08 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv4886/Zope/Publisher

Modified Files:
      Tag: Zope3-publisher-refactor-branch
	DefaultPublication.py 
Log Message:
Got the BrowserPublisher to pass tests.

The remaining task (aside from writing more tests) is to get the
new server setup working.  This should also get the server tests to pass.


=== Zope3/lib/python/Zope/Publisher/DefaultPublication.py 1.1.2.9.4.1 => 1.1.2.9.4.2 ===
 
     def getDefaultTraversal(self, request, ob):
-        return ob, None
+        return ob, ()
 
     def afterTraversal(self, request, ob):
         pass
@@ -67,3 +67,16 @@
         response = request.getResponse()
         response.handleException(exc_info)
 
+
+class TestPublication(DefaultPublication):
+    
+    def traverseName(self, request, ob, name, check_auth=1):
+        if hasattr(ob, name):
+            subob = getattr(ob, name)
+        else:
+            try:
+                subob = ob[name]
+            except (KeyError, IndexError,
+                    TypeError, AttributeError):
+                raise NotFound(ob, name, request)
+        return subob