[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - IContextDependent.py:1.1.2.1 IPresentation.py:1.1.2.1 IPresentationRequest.py:1.1.2.1 IResourceFactory.py:1.1.2.1 IView.py:1.1.2.1 IViewFactory.py:1.1.2.1 ContextDependent.py:1.1.2.4.14.1 GlobalAdapterService.py:1.1.2.3.2.1 GlobalResourceService.py:1.1.2.2.4.1 GlobalUtilityService.py:1.1.2.1.8.1 GlobalViewService.py:1.1.2.2.4.1 IAdapterService.py:1.1.2.5.8.1 IPlacefulComponentArchitecture.py:1.1.2.1.8.1 IResourceService.py:1.1.2.4.8.1 IUtilityService.py:1.1.2.5.8.1 IViewService.py:1.1.2.8.14.1 __init__.py:1.1.6.21.8.1 metaConfigure.py:1.1.2.21.8.1

Jim Fulton jim@zope.com
Wed, 29 May 2002 11:10:23 -0400


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

Modified Files:
      Tag: Zope3InWonderland-branch
	ContextDependent.py GlobalAdapterService.py 
	GlobalResourceService.py GlobalUtilityService.py 
	GlobalViewService.py IAdapterService.py 
	IPlacefulComponentArchitecture.py IResourceService.py 
	IUtilityService.py IViewService.py __init__.py 
	metaConfigure.py 
Added Files:
      Tag: Zope3InWonderland-branch
	IContextDependent.py IPresentation.py IPresentationRequest.py 
	IResourceFactory.py IView.py IViewFactory.py 
Log Message:
- Added permission_id attribute to adapter and utility directives.

- Got rid of old getView, getResource, and getDefaultViewName.
  Renamed getRequestView to getView (and so on).

  Changed view interface to use context, rather than getContext.

  Introduced notion of presentation types (e.g. IBrowserPresentation, 
  which is cleaner than IBrowserPublisher).

- Began converting to get/queryFoo, which is much nicer.

- Many formatting fixups.



=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IContextDependent.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""

$Id: IContextDependent.py,v 1.1.2.1 2002/05/29 15:09:51 jim Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute

class IContextDependent(Interface):

    context = Attribute(
        """The context of the object

        This is the object being adapted, viewed, extemded, etc.
        
        """)


=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IPresentation.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""

$Id: IPresentation.py,v 1.1.2.1 2002/05/29 15:09:51 jim Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute

class IPresentation(Interface):
    """Presentation components provide interfaces to external actors

    The are created for requests, which encapsulate external actors,
    connections, etc.

    """

    request = Attribute(
        """The request

        The request is a surrogate for the user. It also provides the
        presentation type and skin. It is of type
        IPresentationRequest.

        """)


=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IPresentationRequest.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""

$Id: IPresentationRequest.py,v 1.1.2.1 2002/05/29 15:09:51 jim Exp $
"""

from Interface import Interface

class IPresentationRequest(Interface):
    """An IPresentationRequest provides methods for getting view meta data.
    """

    def getPresentationType():
        """Get a view type

        The view type is expressed as an interface, as would be passed
        to IViewService.getView.
        """

    def getPresentationSkin():
        """Get the skin to be used for a request.

        The skin is a string as would be passed
        to IViewService.getView.
        """


=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IResourceFactory.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""

$Id: IResourceFactory.py,v 1.1.2.1 2002/05/29 15:09:51 jim Exp $
"""

from Interface import Interface

class IResourceFactory(Interface):

    def __call__(request):
        """Create a resource for a request

        The request must be an IPresentationRequest.

        """


=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IView.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""

$Id: IView.py,v 1.1.2.1 2002/05/29 15:09:51 jim Exp $
"""

from IContextDependent import IContextDependent
from IPresentation import IPresentation

class IView(IPresentation, IContextDependent):
    """Views provide a connection between an external actor and an object
    """


=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IViewFactory.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""

$Id: IViewFactory.py,v 1.1.2.1 2002/05/29 15:09:51 jim Exp $
"""

from Interface import Interface

class IViewFactory(Interface):

    def __call__(object, request):
        """Create a view for the object and request

        The request must be an IPresentationRequest.

        """


=== Zope3/lib/python/Zope/ComponentArchitecture/ContextDependent.py 1.1.2.4 => 1.1.2.4.14.1 ===
 """
 
+from IContextDependent import IContextDependent
+
 class ContextDependent(object):
+    """standard boilerplate for context dependent objects"""
 
-    """ standard boilerplate for context dependent objects"""
+    __implements__ = IContextDependent
 
     def __init__(self, context):
-        self.__context = context
+        self.context = context
 
-    def getContext(self):
-        return self.__context


=== Zope3/lib/python/Zope/ComponentArchitecture/GlobalAdapterService.py 1.1.2.3 => 1.1.2.3.2.1 ===
 from Exceptions import ComponentLookupError
 from IAdapterService import IAdapterService
-from Zope.ComponentArchitecture import _marker
 from Zope.Proxy.ProxyIntrospection import removeAllProxies
 
 class IGlobalAdapterService(IAdapterService):
@@ -49,14 +48,21 @@
         """see IGlobalAdapterService interface"""
         self.__adapters.register(forInterface, providedInterface, maker)
 
-    def getAdapter(self, object, interface, default=_marker):
+    def getAdapter(self, object, interface):
+        """see IAdapterService interface"""
+        result = self.queryAdapter(object, interface)
+        if result is None:
+            raise ComponentLookupError(object, interface)
+
+        return result
+
+    def queryAdapter(self, object, interface, default=None):
         """see IAdapterService interface"""
         clean_object = removeAllProxies(object)
         if interface.isImplementedBy(clean_object): return object
         makers = self.__adapters.getForObject(clean_object, interface)
         if makers is None:
-            if default is not _marker: return default
-            raise ComponentLookupError(object, interface)
+            return default
         result = object
         for maker in makers:
             result = maker(result)


=== Zope3/lib/python/Zope/ComponentArchitecture/GlobalResourceService.py 1.1.2.2 => 1.1.2.2.4.1 ===
 """
 
-from IToIRegistry import IRegistry
+from IToIRegistry import DataRegistry
 from Exceptions import ComponentLookupError
 from Zope.ComponentArchitecture import getSkin, _marker
 from IResourceService import IResourceService
 
 class IGlobalResourceService(IResourceService):
 
-    def provideResource(name, type, component, layer=''):
+    def provideResource(name, type, factory, layer=''):
         """Provide a resource
 
         A resource is an inependent component that provides a view
@@ -37,7 +37,7 @@
 
         type -- The resource type, expressed as an interface
 
-        component -- the resource component.
+        factory -- an IResourceFactory that computes a resource.
 
         layer -- Optional skin layer. Layers are used to define skins.
         """
@@ -52,32 +52,37 @@
     # Implementation methods for interface
     # Zope.ComponentArchitecture.IResourceService.
 
-    def getResource(self, object, name, type, default=_marker, skin=''):
+    def getResource(self, object, name, request):
         '''See interface IResourceService'''
+
+        resource = self.queryResource(object, name, request)
+
+        if resource is None:
+            raise ComponentLookupError(object, name, type)
+
+        return resource
+
+    def queryResource(self, object, name, request, default=None):
+        '''See interface IResourceService'''
+
+        type = request.getPresentationType()
+        skin = request.getPresentationSkin()
+
         for layername in getSkin(object, skin, type):
             layer = self.__layers.get(layername)
             if not layer: continue
             reg = layer.get(name, None)
             if reg is None: continue
-            c = reg.getForObject(object, type)
-            if c is None: continue
-            return c
+            factory = reg.get(None, type)
+            if factory is None:
+                continue
 
-        if default is _marker:
-            raise ComponentLookupError(object, name, type)
+            return factory(request)
 
         return default
-
-    def getRequestResource(self, object, name, request, default=_marker):
-        '''See interface IResourceService'''
-
-        type = request.getViewType()
-        skin = request.getViewSkin()
-
-        return self.getResource(object, name, type, default, skin)
         
         
-    def provideResource(self, name, type, component, layer=''):
+    def provideResource(self, name, type, factory, layer=''):
         '''See interface IGlobalResourceService'''
 
         resources = self.__layers.get(layer)
@@ -86,9 +91,9 @@
 
         reg = resources.get(name, None)
         if reg is None:
-            reg = resources[name] = IRegistry()
+            reg = resources[name] = DataRegistry()
 
-        reg.register(type, component)
+        reg.register(type, factory)
 
     _clear = __init__
     


=== Zope3/lib/python/Zope/ComponentArchitecture/GlobalUtilityService.py 1.1.2.1 => 1.1.2.1.8.1 ===
     def getUtility(self, interface, default=None):
         """See IUtilityService interface"""
-        c=self.__utilities.get(None, interface)
+        c = self.queryUtility(interface)
         if c is None:
-            if default: return default
             raise ComponentLookupError(interface)
         return c
+
+    def queryUtility(self, interface, default=None):
+        """See IUtilityService interface"""
+        c = self.__utilities.get(None, interface)
+        if c is None:
+            c = default
+        return c
     
     _clear = __init__
 
@@ -60,4 +66,4 @@
 # Register our cleanup with Testing.CleanUp to make writing unit tests simpler.
 from Zope.Testing.CleanUp import addCleanUp
 addCleanUp(_clear)
-del addCleanUp
\ No newline at end of file
+del addCleanUp


=== Zope3/lib/python/Zope/ComponentArchitecture/GlobalViewService.py 1.1.2.2 => 1.1.2.2.4.1 ===
            the interfaces given.
         '''
-    def provideView(forInterface, name, type, maker, layer=''):
-        ""
+        
+    def provideView(forInterface, name, type, factory, layer=''):
+        """Register a view factory
+
+        The factory is a sequence. The last object in the sequence
+        must be an IViewFactory. The other objects in the sequence
+        must be adapter factories.
+        """
 
 class GlobalViewService:
 
@@ -81,44 +87,41 @@
                     
         return result                
 
-    def getView(self, object, name, type, default=_marker, skin=''):
+    def getView(self, object, name, request):
+        '''See interface IViewService'''
+        view = self.queryView(object, name, request)
+        if view is None:
+            raise ComponentLookupError(object, name, type)
+        return view
+
+    def queryView(self, object, name, request, default=None):
         '''See interface IViewService'''
+
+        type = request.getPresentationType()
+        skin = request.getPresentationSkin()
+
         clean_object=removeAllProxies(object)
+
         for layername in getSkin(object, skin, type):
             layer = self.__layers.get(layername)
             if not layer:
                 continue
+
             reg = layer.get(name, None)
             if reg is None:
                 continue
+
             makers = reg.getForObject(clean_object, type)
-            if makers is None:
+            if not makers:
                 continue
 
             result = object
-            for maker in makers:
+            for maker in makers[:-1]:
                 result = maker(result)
 
-            return result
-        
-        if default is _marker:
-            raise ComponentLookupError(object, name, type)
-        return default
-
-    def getRequestView(self, object, name, request, default=_marker):
-        '''See interface IViewService'''
-
-        type = request.getViewType()
-        skin = request.getViewSkin()
-
-        view =  self.getView(object, name, type, default, skin)
+            return makers[-1](result, request)
 
-        # using self as marker
-        setViewRequest = getattr(view, 'setViewRequest', self)        
-        if setViewRequest is not self:
-            setViewRequest(request)
-
-        return view
+        return default
         
         
     def provideView(self, forInterface, name, type, maker, layer=''):
@@ -134,23 +137,27 @@
 
         reg.register(forInterface, type, maker)
 
-    def getDefaultViewName(self, object, type, default=_marker):
+    def getDefaultViewName(self, object, request):
         '''See interface IViewService'''
-        name = self.__default_view_names.getForObject(object, type)
+
+        name = self.queryDefaultViewName(object, request)
+
         if name is None:
-            if default is not _marker:
-                return default
             raise NotFoundError, \
                   'No default view name found for object %s' % object
-        return name
 
+        return name
 
-    def getRequestDefaultViewName(self, object, request, default=_marker):
+    def queryDefaultViewName(self, object, request, default=None):
         '''See interface IViewService'''
-        return self.getDefaultViewName(object,
-                                       request.getViewType(),
-                                       default=default
-                                       )
+
+        type = request.getPresentationType()
+        name = self.__default_view_names.getForObject(object, type)
+
+        if name is None:
+            name = default
+
+        return name
 
     _clear = __init__
     


=== Zope3/lib/python/Zope/ComponentArchitecture/IAdapterService.py 1.1.2.5 => 1.1.2.5.8.1 ===
 class IAdapterService(Interface):
 
-    def getAdapter(object, interface, default=None):
+    def getAdapter(object, interface):
         """Look up an adapter that provides an interface for an object
 
         A Zope.ComponentArchitecture.ComponentLookupError will be
         raised if the component can't be found.
+        """
+
+    def queryAdapter(object, interface, default=None):
+        """Look up an adapter that provides an interface for an object
+
+        The default will be returned if the component can't be found.
         """


=== Zope3/lib/python/Zope/ComponentArchitecture/IPlacefulComponentArchitecture.py 1.1.2.1 => 1.1.2.1.8.1 ===
         service manager if none is higher.  if the context is the global
         service manager, the function raises
-        Zope.ComponentArchitecture.ComponentLookupError"""
+        Zope.ComponentArchitecture.ComponentLookupError."""
 
     def getNextService(context, name):
         """Identical to getNextServiceManager, but will try to find the
@@ -58,20 +58,37 @@
 
     # Utility service
 
-    def getUtility(context, interface, default=None):
-        """returns the nearest utility to the context that implements
-        the specified interface.  If one is not found, returns default
-        if it is passed as an argument, or raises
-        Zope.ComponentArchitecture.ComponentLookupError otherwise"""
+    def getUtility(context, interface):
+        """Get the utility that provides interface
+
+        Returns the nearest utility to the context that implements
+        the specified interface.  If one is not found, raises
+        Zope.ComponentArchitecture.ComponentLookupError."""
+
+    def querytUtility(context, interface, default=None):
+        """Look for the utility that provides interface
+
+        Returns the nearest utility to the context that implements
+        the specified interface.  If one is not found, returns default."""
 
     # Adapter service
 
     def getAdapter(object, interface, default=None, context=None):
-        """returns the nearest adapter to the context that can adapt
+        """Get adapter to interface for object
+
+        Returns the nearest adapter to the context that can adapt
+        object to interface.  If context is not specified, attempts to
+        use wrapping around object to specify a context.  If a matching
+        adapter cannot be found, raises
+        Zope.ComponentArchitecture.ComponentLookupError."""
+
+    def queryAdapter(object, interface, default=None, context=None):
+        """Look for adapter to interface for object
+
+        Returns the nearest adapter to the context that can adapt
         object to interface.  If context is not specified, attempts to
         use wrapping around object to specify a context.  If a matching
-        adapter cannot be found, returns default if it is passed as an argument, or raises
-        Zope.ComponentArchitecture.ComponentLookupError otherwise"""
+        adapter cannot be found, returns default."""
 
     # Factory service
 
@@ -101,40 +118,43 @@
 
     # View service
 
-    def getView(wrapped_object, name, view_type, default=None, skin=''):
-        """Return the named view of a given type for an object and the
-        given skin.  The nearest one to the object is found.  The type
-        is expressed as an interface.  If a
-        matching view cannot be found, returns default
-        if it is passed as an argument, or raises
-        Zope.ComponentArchitecture.ComponentLookupError otherwise.
+    def getView(wrapped_object, name, request):
+        """Get a named view for a given object.
+
+        The request must implement IPresentationRequest: it provides
+        the view type and the skin name.  The nearest one to the
+        object is found. If a matching view cannot be found, raises
+        Zope.ComponentArchitecture.ComponentLookupError.
+        
         """
 
-    def getRequestView(wrapped_object, name, request, default=None):
-        """Look up a named view for a given request and object.  The
-        request must implement IViewRequest: it provides the view
+    def queryView(wrapped_object, name, request, default=None):
+        """Look for a named view for a given object.
+
+        The request must implement IPresentationRequest: it provides the view
         type and the skin name.  The nearest one to the object is
-        found.  If the view implements setViewRequest, that method is
-        called with the Request.  If a matching view cannot be found,
-        returns default if it is passed as an argument, or raises
-        Zope.ComponentArchitecture.ComponentLookupError otherwise.
-        """
-
-    def getDefaultViewName(wrapped_object, view_type, default=None):
-        """Look up the name of the default view of the object for the
-        given view type.  The nearest one to the object is
-        found.  If a matching
-        default view name cannot be found, returns the default argument
-        if it is passed as an argument, or raises Zope.NotFoundError otherwise.
-        """
-
-    def getRequestDefaultViewName(wrapped_object, request, default=None):
-        """Look up the name of the default view of the object for the
-        given request.  The request must implement IViewRequest, and
-        provides the desired view type.  The nearest one to the object is
-        found.  If a matching
-        default view name cannot be found, returns the default argument
-        if it is passed as an argument, or raises Zope.NotFoundError otherwise.
+        found. If a matching view cannot be found, returns default.
+
+        """
+
+    def getDefaultViewName(wrapped_object, request):
+        """Get the name of the default view for the object and request.
+
+        The request must implement IPresentationRequest, and provides the
+        desired view type.  The nearest one to the object is found.
+        If a matching default view name cannot be found, raises
+        Zope.NotFoundError.
+        
+        """
+
+    def queryDefaultViewName(wrapped_object, request, default=None):
+        """Look for the name of the default view for the object and request.
+        
+        The request must implement IPresentationRequest, and provides the
+        desired view type.  The nearest one to the object is found.
+        If a matching default view name cannot be found, returns the
+        default.
+        
         """
 
     def getViewDefinitions(context, name=None, used_for=None, \
@@ -161,30 +181,23 @@
 
     # Resource service
 
-    def getResource(wrapped_object, name, type, default=None, skin=''):
-        """Look up a named resource of a given type
+    def getResource(wrapped_object, name, request):
+        """Get a named resource for a given request
 
-        The type is expressed as an interface.
+        The request must implement IPresentationRequest.
 
         The object provides a place to look for placeful resources.
         
-        If the component can't be found, and a default argument was
-        passed to the function, the default argument is returned.
-
         A Zope.ComponentArchitecture.ComponentLookupError will be
-        raised if the component can't be found otherwise.
+        raised if the component can't be found.
         """
 
-    def getRequestResource(wrapped_object, name, request, default=None):
-        """Look up a named resource for a given request
+    def queryResource(wrapped_object, name, request, default=None):
+        """Get a named resource for a given request
 
-        The request must implement IViewRequest.
+        The request must implement IPresentationRequest.
 
         The object provides a place to look for placeful resources.
         
-        If the component can't be found, and a default argument was
-        passed to the function, the default argument is returned.
-
-        A Zope.ComponentArchitecture.ComponentLookupError will be
-        raised if the component can't be found.
-        """
\ No newline at end of file
+        If the component can't be found, the default is returned.
+        """


=== Zope3/lib/python/Zope/ComponentArchitecture/IResourceService.py 1.1.2.4 => 1.1.2.4.8.1 ===
 class IResourceService(Interface):
 
-    def getResource(object, name, type, default=None, skin=''):
-        """Look up a named resource of a given type
+    def getResource(object, name, request):
+        """Look up a named resource for a given request
 
-        The type is expressed as an interface.
+        The request must implement IPresentationRequest.
 
         The object provides a place to look for placeful resources.
 
@@ -31,13 +31,18 @@
         raised if the component can't be found.
         """
 
-    def getRequestResource(object, name, request, default=None):
+    def queryResource(object, name, request, default=None):
         """Look up a named resource for a given request
 
-        The request must implement IViewRequest.
+        The request must implement IPresentationRequest.
 
         The object provides a place to look for placeful resources.
 
-        A Zope.ComponentArchitecture.ComponentLookupError will be
-        raised if the component can't be found.
+        The default will be returned if the component can't be found.
         """
+
+
+
+
+
+


=== Zope3/lib/python/Zope/ComponentArchitecture/IUtilityService.py 1.1.2.5 => 1.1.2.5.8.1 ===
 class IUtilityService(Interface):
 
+    def getUtility(interface):
+        """Look up a utility that provides interface.
+
+        If one is not found, raises
+        Zope.ComponentArchitecture.ComponentLookupError."""
+
     def getUtility(interface, default=None):
-        """Look up a utility that provides an interface in this
-        service, delegating to the next higher service if one is not
-        found.  If one is not found, returns default if not None, or raises
-        Zope.ComponentArchitecture.ComponentLookupError otherwise"""
+        """Look up a utility that provides an interface.
+
+        If one is not found, returns default."""
 


=== Zope3/lib/python/Zope/ComponentArchitecture/IViewService.py 1.1.2.8 => 1.1.2.8.14.1 ===
 class IViewService(Interface):
 
-    def getView(object, name, type, default=None, skin=''):
-        """Look up a named view of a given type for an object
+    def getView(object, name, request):
+        """Get a named view for a given object and request
 
-        The type is expressed as an interface.
+        The request must implement IPresentationRequest.
 
         The object also provides a place to look for placeful views.
 
@@ -31,33 +31,32 @@
         raised if the component can't be found.
         """
 
-    def getRequestView(object, name, request, default=None):
-        """Look up a named view for a given request
+    def queryView(object, name, request, default=None):
+        """Look for a named view for a given object and request
 
-        The request must implement IViewRequest.
+        The request must implement IPresentationRequest.
 
         The object also provides a place to look for placeful views.
 
-        If the view implements setViewRequest, that method is
-        called with the Request.
-
-        A Zope.ComponentArchitecture.ComponentLookupError will be
-        raised if the component can't be found.
+        The default will be returned
+        if the component can't be found.
         """
 
-    def getDefaultViewName(object, type, default=None):
-        """Look up the name of the default view for the object
+    def getDefaultViewName(object, request):
+        """Get the name of the default view for the object and request
+        
+        The request must implement IPresentationRequest.
 
         A Zope.NotFoundError will be raised if the suitable
         default view name for the object cannot be found.
         """
 
-    def getRequestDefaultViewName(object, request, default=None):
-        """Look up the name of the default view for the object
+    def queryDefaultViewName(object, request, default=None):
+        """Look for the name of the default view for the object and request
         
-        The request must implement IViewRequest.
+        The request must implement IPresentationRequest.
 
-        A Zope.NotFoundError will be raised if the suitable
+        The default will be returned if a suitable
         default view name for the object cannot be found.
         """
 
@@ -78,22 +77,4 @@
 
         The arguments may be given as keyword arguments and define a
         query for the retrieval.
-        """
-
-class IViewRequest(Interface):
-    """An IViewRequest provides methods for getting view meta data.
-    """
-
-    def getViewType():
-        """Get a view type
-
-        The view type is expressed as an interface, as would be passed
-        to IViewService.getView.
-        """
-
-    def getViewSkin():
-        """Get the skin to be used for a request.
-
-        The skin is a string as would be passed
-        to IViewService.getView.
         """


=== Zope3/lib/python/Zope/ComponentArchitecture/__init__.py 1.1.6.21 => 1.1.6.21.8.1 ===
 # Utility service
 
-def getUtility(context, interface, default=None):
-    return getService(context, 'Utilities').getUtility(interface, default)
+def getUtility(context, interface):
+    return getService(context, 'Utilities').getUtility(interface)
+
+def queryUtility(context, interface, default=None):
+    return getService(context, 'Utilities').queryUtility(interface, default)
 
 # Adapter service
 
-def getAdapter(object, interface, default=_marker, context=None):
+def getAdapter(object, interface, context=None):
+    if context is None:
+        context = object
+    return getService(context, 'Adapters').getAdapter(
+        object, interface)
+
+def queryAdapter(object, interface, default=_marker, context=None):
     if context is None:
         context = object
-    return getService(context, 'Adapters').getAdapter(object, interface, default)
+    return getService(context, 'Adapters').queryAdapter(
+        object, interface, default)
 
 # Factory service
 
@@ -91,25 +101,24 @@
 
 # View service
 
-def getView(wrapped_object, name, view_type, default=_marker, skin=''):
+def getView(wrapped_object, name, request):
     return getService(wrapped_object, 
-                      'Views').getView(wrapped_object, name, view_type,
-                                                default, skin)
+                      'Views').getView(wrapped_object, name, request)
 
-def getRequestView(wrapped_object, name, request, default=_marker):
+def queryView(wrapped_object, name, request, default=None):
     return getService(wrapped_object, 
-                      'Views').getRequestView(wrapped_object, name,
-                                                       request, default)
+                      'Views').queryView(wrapped_object, name,
+                                         request, default)
 
-def getDefaultViewName(wrapped_object, view_type, default=_marker):
+def getDefaultViewName(wrapped_object, request):
     return getService(wrapped_object, 
                       'Views').getDefaultViewName(wrapped_object,
-                                                           view_type, default)
+                                                  request)
 
-def getRequestDefaultViewName(wrapped_object, request, default=_marker):
-    return getService(wrapped_object, 
-                      'Views').getRequestDefaultViewName(wrapped_object,
-                                                           request, default)
+def queryDefaultViewName(wrapped_object, request, default=None):
+    return getService(wrapped_object,
+                      'Views').queryDefaultViewName(wrapped_object,
+                                                    request, default)
 
 def getViewDefinitions(context, name=None, used_for=None, 
                        view_type=None, layer=None):
@@ -119,16 +128,15 @@
 
 # Resource service
 
-def getResource(wrapped_object, name, type, default=_marker, skin=''):
-    return getService(wrapped_object, 
-                      'Resources').getResource(wrapped_object, name,
-                                                        type, default, skin)
+def getResource(wrapped_object, name, request):
+    return getService(wrapped_object,
+                      'Resources').getResource(
+        wrapped_object, name, request)
 
-def getRequestResource(wrapped_object, name, request, default=_marker):
+def queryResource(wrapped_object, name, request, default=None):
     return getService(wrapped_object,
-                      'Resources').getRequestResource(wrapped_object, name,
-                                                               request,
-                                                               default)
+                      'Resources').queryResource(
+        wrapped_object, name, request, default)
 
 
 #def _clear():


=== Zope3/lib/python/Zope/ComponentArchitecture/metaConfigure.py 1.1.2.21 => 1.1.2.21.8.1 ===
 from Zope.Configuration.Action import Action
 
+from Zope.Security.Proxy import Proxy
+from Zope.Security.Checker import InterfaceChecker, CheckerPublic
+
 # I prefer the indirection (using getService and getServiceManager vs.
 # directly importing the various services)  not only because it makes
 # unit tests easier, but also because it reinforces that the services
@@ -37,20 +40,35 @@
     method=getattr(getServiceManager(None), methodName)
     method(*args, **kwargs)
 
-def adapter(_context, factory, provides, for_=None):
+def adapter(_context, factory, provides, for_=None, permission_id=None):
     if for_ is not None: for_ = _context.resolve(for_)
     provides = _context.resolve(provides)
+    factory = map(_context.resolve, factory.split())
+
+    if permission_id is not None:
+        if permission_id == 'Zope.Public':
+            permission_id = CheckerPublic
+        checker = InterfaceChecker(provides, permission_id)
+        factory.append(lambda c: Proxy(c, checker))
+
     return [
         Action(
             discriminator = ('adapter', for_, provides),
             callable = handler,
-            args = ('Adapters', 'provideAdapter', for_, provides, _context.resolve(factory)),
+            args = ('Adapters', 'provideAdapter', for_, provides, factory),
             )
         ]
 
-def utility(_context, component, provides):
+def utility(_context, component, provides, permission_id=None):
     provides = _context.resolve(provides)
     component = _context.resolve(component)
+
+    if permission_id is not None:
+        if permission_id == 'Zope.Public':
+            permission_id = CheckerPublic
+        checker = InterfaceChecker(provides, permission_id)
+        component = Proxy(component, checker)
+
     return [
         Action(
             discriminator = ('utility', provides),
@@ -76,7 +94,7 @@
 def view(_context, factory, type, name, for_=None, layer=''):
     if for_ is not None: for_ = _context.resolve(for_)
     type = _context.resolve(type)
-    factory = _context.resolve(factory)
+    factory = map(_context.resolve, factory.split())
     return [
         Action(
             discriminator = ('view', for_, name, type, layer),
@@ -88,7 +106,7 @@
 def defaultView(_context, factory, type, name, for_=None, layer=''):
     if for_ is not None: for_ = _context.resolve(for_)
     type = _context.resolve(type)
-    factory = _context.resolve(factory)
+    factory = map(_context.resolve, factory.split())
     return [
         Action(
             discriminator = ('view', for_, name, type),
@@ -103,14 +121,14 @@
         ]
 
 
-def resource(_context, component, type, name, layer=''):
+def resource(_context, factory, type, name, layer=''):
     type = _context.resolve(type)
-    component = _context.resolve(component)
+    factory = _context.resolve(factory)
     return [
         Action(
             discriminator = ('resource', name, type, layer),
             callable = handler,
-            args = ('Resources','provideResource',name, type, component, layer),
+            args = ('Resources','provideResource', name, type, factory, layer),
             )
         ]