[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container - ContainerTraverser.py:1.1.2.4.14.2

Jim Fulton jim@zope.com
Sun, 2 Jun 2002 10:35:10 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container
In directory cvs.zope.org:/tmp/cvs-serv29793/lib/python/Zope/App/OFS/Container

Modified Files:
      Tag: Zope3InWonderland-branch
	ContainerTraverser.py 
Log Message:
- Added template attribute to allow views to be created from a
  template source file.

- Added beginnings of a Zope debugger. This required seperating site
  and server configuration.

- Added the ability to specify a config file package in the
  zopeConfigure directive. Made "config.zcml" a default for the file
  attribute in the include directive.

- Fixed mapply to unwrap proxied objects. This was necessary once
  views became wrapped in proxies. We need to investigate why they
  weren't being wrapped before. 

- I updated enough system page templates and zcml directives so that:

  - Zope now starts. :)

  - The root folder contents listing can be viewed.

  Many more templates and zcml files need to be updated to reflect the
  way views are now handled.



=== Zope3/lib/python/Zope/App/OFS/Container/ContainerTraverser.py 1.1.2.4.14.1 => 1.1.2.4.14.2 ===
 from Zope.Publisher.Exceptions import NotFound
 from IContainer import IReadContainer
-from Zope.ComponentArchitecture import getView
+from Zope.ComponentArchitecture import queryView
 from Zope.ComponentArchitecture import getDefaultViewName
 
 
@@ -30,27 +30,27 @@
     __implements__ = IBrowserPublisher, IXMLRPCPublisher
     __used_for__ = IReadContainer
 
-    def __init__(self, c):
-        self._c = c
+    def __init__(self, container, request):
+        self.context = container
 
     def publishTraverse(self, request, name):
-        c = self._c
-        if name.endswith(';view'):
-            p = getView(c, name[:-5], request)
-            if p is None:
-                raise NotFound(c, name, request)
-            else:
-                return p
+        c = self.context
+
         subob = c.getObject(name, None)
         if subob is None:
+
+            view = queryView(c, name, request)
+            if view is not None:
+                return view
+
             raise NotFound(c, name, request)
         return subob
 
     def browserDefault(self, request):
         """
         """
-        c = self._c
+        c = self.context
         view_name = getDefaultViewName(c, request)
-        view_uri = "%s;view" % view_name
+        view_uri = "view::%s" % view_name
         return c, (view_uri,)