[Zope3-checkins] CVS: Zope3/src/zope/app/publication - browser.py:1.14 publicationtraverse.py:1.13 traversers.py:1.7

Philipp von Weitershausen philikon at philikon.de
Wed Mar 17 13:24:56 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/publication
In directory cvs.zope.org:/tmp/cvs-serv24200/app/publication

Modified Files:
	browser.py publicationtraverse.py traversers.py 
Log Message:


The traversing machinery now uses views providing an interface
(IPublishTraverse or subclassing interfaces) instead of views named
"_traverse".




=== Zope3/src/zope/app/publication/browser.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/publication/browser.py:1.13	Sat Mar  6 12:48:52 2004
+++ Zope3/src/zope/app/publication/browser.py	Wed Mar 17 13:24:25 2004
@@ -20,7 +20,7 @@
 from zope.app.publication.publicationtraverse \
      import PublicationTraverser as PublicationTraverser_
 from zope.app.publication.zopepublication import ZopePublication
-from zope.component import queryView
+from zope.component import queryViewProviding
 from zope.proxy import removeAllProxies
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.security.checker import ProxyFactory
@@ -31,7 +31,7 @@
 
         ob = self.traversePath(request, ob, path)
 
-        while 1:
+        while True:
             adapter = IBrowserPublisher(ob, None)
             if adapter is None:
                 return ob
@@ -50,7 +50,7 @@
             # ob is already proxied, so the result of calling a method will be
             return ob.browserDefault(request)
         else:
-            adapter = queryView(ob, '_traverse', request , None)
+            adapter = queryViewProviding(ob, IBrowserPublisher, request , None)
             if adapter is not None:
                 ob, path = adapter.browserDefault(request)
                 ob = ProxyFactory(ob)


=== Zope3/src/zope/app/publication/publicationtraverse.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/publication/publicationtraverse.py:1.12	Fri Mar  5 17:09:13 2004
+++ Zope3/src/zope/app/publication/publicationtraverse.py	Wed Mar 17 13:24:25 2004
@@ -12,11 +12,9 @@
 #
 ##############################################################################
 """
-
 $Id$
 """
-
-from zope.component import queryView
+from zope.component import queryViewProviding
 from zope.publisher.interfaces import NotFound
 from types import StringTypes
 from zope.security.checker import ProxyFactory
@@ -71,7 +69,8 @@
         if IPublishTraverse.providedBy(removeAllProxies(ob)):
             ob2 = ob.publishTraverse(request, nm)
         else:
-            adapter = queryView(ob, '_traverse', request, self) # marker
+            # self is marker
+            adapter = queryViewProviding(ob, IPublishTraverse, request, self)
             if adapter is not self:
                 ob2 = adapter.publishTraverse(request, nm)
                 # ob2 will be security proxied here becuase the adapter


=== Zope3/src/zope/app/publication/traversers.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/publication/traversers.py:1.6	Fri Jun  6 16:25:30 2003
+++ Zope3/src/zope/app/publication/traversers.py	Wed Mar 17 13:24:25 2004
@@ -11,7 +11,9 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"$Id"
+"""
+$Id
+"""
 
 __metaclass__ = type
 
@@ -32,9 +34,7 @@
 
     def browserDefault(self, request):
         ob = self.context
-
         view_name = getDefaultViewName(ob, request)
-
         return ob, (view_name,)
 
     def publishTraverse(self, request, name):
@@ -50,7 +50,6 @@
     The default view for file content has effective URLs that don't end in
     /.  In particular, if the content inclused HTML, relative links in
     the HTML are relative to the container the content is in.
-
     """
 
     def browserDefault(self, request):
@@ -69,8 +68,7 @@
         return view, path
 
 class TestTraverser:
-    "Bobo-style traverser, mostly useful for testing"
-
+    """Bobo-style traverser, mostly useful for testing"""
     implements(IBrowserPublisher)
 
     def __init__(self, context, request):
@@ -80,9 +78,7 @@
         ob = self.context
 
         if providedBy(ob):
-
             view_name = getDefaultViewName(ob, request)
-
             return ob, (("@@%s" % view_name),)
 
         return ob, ()




More information about the Zope3-Checkins mailing list