[Zope3-checkins] CVS: Zope3/src/zope/component/tests - placelesssetup.py:1.6.28.1 request.py:1.2.56.1 test_api.py:1.10.24.1 test_resources.py:NONE test_skins.py:NONE test_view.py:NONE test_viewservice.py:NONE

Jim Fulton cvs-admin at zope.org
Sun Nov 9 11:09:03 EST 2003


Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv15349/src/zope/component/tests

Modified Files:
      Tag: adaptergeddon-branch
	placelesssetup.py request.py test_api.py 
Removed Files:
      Tag: adaptergeddon-branch
	test_resources.py test_skins.py test_view.py 
	test_viewservice.py 
Log Message:
Created a global presentation service that replaces the 
global view, resource, and skin services.

Now look up presentation components by adapting from a request type,
rather than adapting to a presentation type.





=== Zope3/src/zope/component/tests/placelesssetup.py 1.6 => 1.6.28.1 ===
--- Zope3/src/zope/component/tests/placelesssetup.py:1.6	Tue Jun  3 10:39:51 2003
+++ Zope3/src/zope/component/tests/placelesssetup.py	Sun Nov  9 11:08:32 2003
@@ -21,8 +21,8 @@
 
 from zope.testing.cleanup import CleanUp
 from zope.component import getServiceManager
-from zope.component.servicenames import Adapters, Skins, Utilities
-from zope.component.servicenames import Resources, Factories
+from zope.component.servicenames import Adapters, Utilities
+from zope.component.servicenames import Factories, Presentation
 
 class PlacelessSetup(CleanUp):
     def setUp(self):
@@ -30,35 +30,30 @@
         sm = getServiceManager(None)
         defineService = sm.defineService
         provideService = sm.provideService
+
         # factory service
         from zope.component.interfaces import IFactoryService
         defineService(Factories, IFactoryService)
         from zope.component.factory import factoryService
         provideService(Factories, factoryService)
+
         # utility service
         from zope.component.interfaces import IUtilityService
         defineService(Utilities, IUtilityService)
         from zope.component.utility import utilityService
         provideService(Utilities, utilityService)
+
         # adapter service
         from zope.component.interfaces import IAdapterService
         defineService(Adapters, IAdapterService)
         from zope.component.adapter import adapterService
         provideService(Adapters, adapterService)
-        # resource service
-        from zope.component.interfaces import IResourceService
-        defineService(Resources, IResourceService)
-        from zope.component.resource import resourceService
-        provideService(Resources, resourceService)
-        # skin service
-        from zope.component.interfaces import ISkinService
-        defineService(Skins, ISkinService)
-        from zope.component.skin import skinService
-        provideService(Skins, skinService)
-        # view service
-        from zope.component.interfaces import IViewService
-        defineService('Views', IViewService)
-        from zope.component.view import viewService
-        provideService('Views', viewService)
+        
+        # presentation service
+        from zope.component.interfaces import IPresentationService
+        defineService(Presentation, IPresentationService)
+        from zope.component.presentation import GlobalPresentationService
+        provideService(Presentation, GlobalPresentationService())
+
     def tearDown(self):
         CleanUp.tearDown(self)


=== Zope3/src/zope/component/tests/request.py 1.2 => 1.2.56.1 ===
--- Zope3/src/zope/component/tests/request.py:1.2	Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/request.py	Sun Nov  9 11:08:32 2003
@@ -16,18 +16,14 @@
 $Id$
 """
 
+import zope.interface
+
 class Request:
 
-    def __init__(self, iface, skin=''):
-        self._iface     = iface
-        self._skin      = skin
+    def __init__(self, type, skin=''):
+        self._skin = skin
+        zope.interface.directlyProvides(self, type)
 
     def getPresentationSkin(self):
-        '''See interface IPresentationRequest'''
-
         return self._skin
 
-    def getPresentationType(self):
-        '''See interface IPresentationRequest'''
-
-        return self._iface


=== Zope3/src/zope/component/tests/test_api.py 1.10 => 1.10.24.1 ===
--- Zope3/src/zope/component/tests/test_api.py:1.10	Tue Jun 24 11:29:54 2003
+++ Zope3/src/zope/component/tests/test_api.py	Sun Nov  9 11:08:32 2003
@@ -14,10 +14,12 @@
 
 import unittest
 
+from zope.component import servicenames
 from zope.component import getAdapter, queryAdapter
 from zope.component import getNamedAdapter, queryNamedAdapter
 from zope.component import getService
 from zope.component import getUtility, queryUtility
+from zope.component import getDefaultViewName
 from zope.component.exceptions import ComponentLookupError
 from zope.component.servicenames import Adapters
 from zope.component.tests.placelesssetup import PlacelessSetup
@@ -238,7 +240,7 @@
                           getView, ob, 'foo', Request(I2))
         self.assertEquals(queryView(ob, 'foo', Request(I2), Test), Test)
 
-        getService(None, 'Views').provideView(I1, 'foo', I2, [Comp])
+        getService(None, servicenames.Presentation).provideView(I1, 'foo', I2, [Comp])
         c = getView(ob, 'foo', Request(I2))
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -265,7 +267,7 @@
         self.assertEquals(queryView(ob, 'foo', Request(I2), Test, context=ob),
                           Test)
 
-        getService(None, 'Views').provideView(I1, 'foo', I2, [Comp])
+        getService(None, servicenames.Presentation).provideView(I1, 'foo', I2, [Comp])
         c = getView(ob, 'foo', Request(I2), context=ob)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -285,15 +287,15 @@
     def testDefaultViewName(self):
         from zope.component import getService
         from zope.exceptions import NotFoundError
-        viewService = getService(None, 'Views')
+        viewService = getService(None, servicenames.Presentation)
         self.assertRaises(NotFoundError,
-                          viewService.getDefaultViewName,
+                          getDefaultViewName,
                           ob, Request(I1))
         viewService.setDefaultViewName(I1, I2, 'sample_name')
-        self.assertEquals(viewService.getDefaultViewName(ob, Request(I2)),
+        self.assertEquals(getDefaultViewName(ob, Request(I2)),
                           'sample_name')
         self.assertRaises(NotFoundError,
-                          viewService.getDefaultViewName,
+                          getDefaultViewName,
                           ob, Request(I1))
 
 def test_suite():

=== Removed File Zope3/src/zope/component/tests/test_resources.py ===

=== Removed File Zope3/src/zope/component/tests/test_skins.py ===

=== Removed File Zope3/src/zope/component/tests/test_view.py ===

=== Removed File Zope3/src/zope/component/tests/test_viewservice.py ===




More information about the Zope3-Checkins mailing list