[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - Traversers.py:1.4

Jim Fulton jim@zope.com
Thu, 11 Jul 2002 14:22:06 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication
In directory cvs.zope.org:/tmp/cvs-serv7355/lib/python/Zope/App/ZopePublication

Modified Files:
	Traversers.py 
Log Message:

Reimplemented service managers to be package based. Service managers
are no longer containers. They have a packages subobject (not a
packages service) that contains packages. TTW components are created
in packages. To register a component, create the appropriate component
directive objects (these should be called configuration objects).

This should be viewed as a prototype to illustrate the idea of
packages. Lots of things can change (especially UI) and many things
aren't done (e.g. visiting created directives).

In the course of this, I fixed a bunch of bugs and problems in
traversal machinery. 

I also renamed Zope.ComponentArchitecture.IServiceManager back to
IServiceService, since this interface doesn't actually specify any
management.  



=== Zope3/lib/python/Zope/App/ZopePublication/Traversers.py 1.3 => 1.4 ===
 # FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
+"$Id"
+
+__metaclass__ = type
+
+
 from Zope.Publisher.Exceptions import Unauthorized, NotFound, DebugError
 from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
 from Zope.Publisher.XMLRPC.IXMLRPCPublisher import IXMLRPCPublisher
@@ -23,18 +28,19 @@
     """
     __implements__ = IBrowserPublisher, IXMLRPCPublisher
 
-    def __init__(self, target, request):
-        self.target = target
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
 
     def browserDefault(self, request):
-        ob = self.target
+        ob = self.context
         
         view_name = getDefaultViewName(ob, request)
 
         return ob, (view_name,)
 
     def publishTraverse(self, request, name):
-        ob = self.target
+        ob = self.context
         from Zope.ComponentArchitecture.GlobalViewService import viewService
         try:
             return getView(ob, name, request)
@@ -53,7 +59,7 @@
     """
 
     def browserDefault(self, request):
-        ob = self.target
+        ob = self.context
         
         view_name = getDefaultViewName(ob, request)
         view = self.publishTraverse(request, view_name)
@@ -72,11 +78,11 @@
 
     __implements__ = IBrowserPublisher
 
-    def __init__(self, target, request):
-        self.target = target
+    def __init__(self, context, request):
+        self.context = context
 
     def browserDefault(self, request):
-        ob = self.target
+        ob = self.context
 
         if hasattr(ob, '__implements__'):
         
@@ -87,7 +93,7 @@
         return ob, ()
 
     def publishTraverse(self, request, name):
-        ob = self.target
+        ob = self.context
         if name.startswith('@@'):
             return getView(ob, name[6:], request)