[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/component/ The presentation service is gone.

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Sep 17 12:16:06 EDT 2004


Log message for revision 27584:
  
  The presentation service is gone.
  
  Use adapter service instead.
  
  


Changed:
  U   Zope3/trunk/src/zope/app/component/hooks.py
  U   Zope3/trunk/src/zope/app/component/metaconfigure.py


-=-
Modified: Zope3/trunk/src/zope/app/component/hooks.py
===================================================================
--- Zope3/trunk/src/zope/app/component/hooks.py	2004-09-17 16:16:04 UTC (rev 27583)
+++ Zope3/trunk/src/zope/app/component/hooks.py	2004-09-17 16:16:06 UTC (rev 27584)
@@ -27,7 +27,6 @@
 from zope.app.traversing.interfaces import IContainmentRoot
 from zope.app.location.interfaces import ILocation
 from zope.app.location import locate
-from zope.component.servicenames import Presentation
 from zope.interface import Interface
 from zope.component.servicenames import Adapters
 import warnings
@@ -114,9 +113,9 @@
     
 def queryView(object, name, request, default=None,
               providing=Interface, context=None):
-    views = getService(Presentation, context)
-    view = views.queryView(object, name, request, default=default,
-                           providing=providing)
+    adapters = getService(Adapters, context)
+    view = adapters.queryMultiAdapter((object, request), providing,
+                                      name, default)
     if ILocation.providedBy(view):
         locate(view, object, name)
 

Modified: Zope3/trunk/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/component/metaconfigure.py	2004-09-17 16:16:04 UTC (rev 27583)
+++ Zope3/trunk/src/zope/app/component/metaconfigure.py	2004-09-17 16:16:06 UTC (rev 27584)
@@ -17,17 +17,17 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.interface import Interface
+from zope.component.interfaces import IDefaultViewName, IFactory
 from zope.component.service import UndefinedService
 from zope.configuration.exceptions import ConfigurationError
-from zope.security.checker import InterfaceChecker, CheckerPublic, \
-     Checker, NamesChecker
+from zope.interface import Interface
+
+from zope.security.checker import InterfaceChecker, CheckerPublic
+from zope.security.checker import Checker, NamesChecker
 from zope.security.proxy import Proxy, ProxyFactory
-from zope.component.interfaces import IFactory
 
 from zope.app import zapi
 from zope.app.component.interface import queryInterface
-from zope.app.servicenames import Adapters, Presentation
 from zope.app.security.adapter import TrustedAdapterFactory
 
 PublicPermission = 'zope.Public'
@@ -107,7 +107,7 @@
     _context.action(
         discriminator = None,
         callable = handler,
-        args = (Adapters, 'subscribe',
+        args = (zapi.servicenames.Adapters, 'subscribe',
                 for_, provides, factory),
         )
 
@@ -159,7 +159,7 @@
     _context.action(
         discriminator = ('adapter', for_, provides, name),
         callable = handler,
-        args = (Adapters, 'register',
+        args = (zapi.servicenames.Adapters, 'register',
                 for_, provides, name, factory, _context.info),
         )
     _context.action(
@@ -232,7 +232,7 @@
     checker = Checker(require)
     return checker
 
-def resource(_context, factory, type, name, layer='default',
+def resource(_context, factory, type, name, layer=None,
              permission=None,
              allowed_interface=None, allowed_attributes=None,
              provides=Interface):
@@ -254,11 +254,14 @@
 
         factory = proxyResource
 
+    if layer is None:
+        layer = type
+
     _context.action(
-        discriminator = ('resource', name, type, layer, provides),
+        discriminator = ('resource', name, layer, provides),
         callable = handler,
-        args = (Presentation, 'provideResource',
-                name, type, factory, layer, provides),
+        args = (zapi.servicenames.Adapters, 'register',
+                (layer,), provides, name, factory, _context.info),
         )
     _context.action(
         discriminator = None,
@@ -271,7 +274,7 @@
         args = (provides.__module__ + '.' + provides.__name__, type)
                )
 
-def view(_context, factory, type, name, for_, layer='default',
+def view(_context, factory, type, name, for_, layer=None,
          permission=None, allowed_interface=None, allowed_attributes=None,
          provides=Interface):
 
@@ -321,11 +324,17 @@
                 ob = f(ob)
             return factories[-1](ob, request)
 
+    # Make type/layer one of the required interfaces.
+    if layer is None:
+        for_ = for_ + (type,)
+    else:
+        for_ = for_ + (layer,)
+
     _context.action(
-        discriminator = ('view', for_, name, type, layer, provides),
+        discriminator = ('view', for_, name, provides),
         callable = handler,
-        args = (Presentation, 'provideAdapter',
-                type, factory, name, for_, provides, layer, _context.info),
+        args = (zapi.servicenames.Adapters, 'register',
+                for_, provides, name, factory, _context.info),
         )
     if type is not None:
         _context.action(
@@ -354,7 +363,8 @@
     _context.action(
         discriminator = ('defaultViewName', for_, type, name),
         callable = handler,
-        args = (Presentation, 'setDefaultViewName', for_, type, name),
+        args = (zapi.servicenames.Adapters, 'register',
+                (for_, type), IDefaultViewName, '', name, _context.info)
         )
     
     _context.action(



More information about the Zope3-Checkins mailing list