[Zope3-checkins] CVS: Zope3/src/zope/app/tests - setup.py:1.7.6.2 test_clipboard.py:1.6.32.1 test_rename.py:1.2.6.1 ztapi.py:1.1.2.2

Jim Fulton cvs-admin at zope.org
Tue Nov 18 17:27:08 EST 2003


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

Modified Files:
      Tag: adaptergeddon-branch
	setup.py test_clipboard.py test_rename.py ztapi.py 
Log Message:
Implemented local presentation services.


=== Zope3/src/zope/app/tests/setup.py 1.7.6.1 => 1.7.6.2 ===
--- Zope3/src/zope/app/tests/setup.py:1.7.6.1	Sun Nov  9 11:08:29 2003
+++ Zope3/src/zope/app/tests/setup.py	Tue Nov 18 17:26:37 2003
@@ -19,7 +19,6 @@
 import zope.component
 from zope.app import zapi
 from zope.app.tests import ztapi
-from zope.component.adapter import provideAdapter
 from zope.interface import classImplements
 
 #------------------------------------------------------------------------
@@ -28,16 +27,16 @@
 from zope.app.interfaces.annotation import IAnnotations
 from zope.app.interfaces.annotation import IAttributeAnnotatable
 def setUpAnnotations():
-    provideAdapter(IAttributeAnnotatable, IAnnotations,
-                   AttributeAnnotations)
+    ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
+                         AttributeAnnotations)
 
 #------------------------------------------------------------------------
 # Dependencies
 from zope.app.dependable import Dependable
 from zope.app.interfaces.dependable import IDependable
 def setUpDependable():
-    provideAdapter(IAttributeAnnotatable, IDependable,
-                   Dependable)
+    ztapi.provideAdapter(IAttributeAnnotatable, IDependable,
+                         Dependable)
 
 #------------------------------------------------------------------------
 # Traversal
@@ -53,14 +52,14 @@
 from zope.app.traversing.namespace import etc, provideNamespaceHandler
 
 def setUpTraversal():
-    provideAdapter(None, ITraverser, Traverser)
-    provideAdapter(None, ITraversable, DefaultTraversable)
+    ztapi.provideAdapter(None, ITraverser, Traverser)
+    ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
 
-    provideAdapter(
+    ztapi.provideAdapter(
         ISimpleReadContainer, ITraversable, ContainerTraversable)
-    provideAdapter(
+    ztapi.provideAdapter(
         None, IPhysicallyLocatable, LocationPhysicallyLocatable)
-    provideAdapter(
+    ztapi.provideAdapter(
         IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
 
     # set up etc namespace
@@ -75,8 +74,8 @@
 from zope.app.interfaces.services.registration import IRegistered
 from zope.app.services.registration import Registered
 def setUpRegistered():
-    provideAdapter(IAttributeRegisterable, IRegistered,
-                   Registered)
+    ztapi.provideAdapter(IAttributeRegisterable, IRegistered,
+                         Registered)
 
 
 #------------------------------------------------------------------------


=== Zope3/src/zope/app/tests/test_clipboard.py 1.6 => 1.6.32.1 ===
--- Zope3/src/zope/app/tests/test_clipboard.py:1.6	Thu May 29 14:15:56 2003
+++ Zope3/src/zope/app/tests/test_clipboard.py	Tue Nov 18 17:26:37 2003
@@ -20,7 +20,7 @@
 from zope.app.interfaces.copypastemove import IPrincipalClipboard
 from zope.app.copypastemove import PrincipalClipboard
 from zope.component import getAdapter, getService, getServiceManager
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.app.services.principalannotation \
     import PrincipalAnnotationService
 from zope.app.interfaces.services.principalannotation \
@@ -35,7 +35,8 @@
         PlacefulSetup.setUp(self)
         self.buildFolders()
 
-        provideAdapter(IAnnotations, IPrincipalClipboard, PrincipalClipboard)
+        ztapi.provideAdapter(IAnnotations, IPrincipalClipboard,
+                             PrincipalClipboard)
         root_sm = getServiceManager(None)
         svc = PrincipalAnnotationService()
         root_sm.defineService("PrincipalAnnotation", \


=== Zope3/src/zope/app/tests/test_rename.py 1.2 => 1.2.6.1 ===
--- Zope3/src/zope/app/tests/test_rename.py:1.2	Sun Sep 21 13:33:38 2003
+++ Zope3/src/zope/app/tests/test_rename.py	Tue Nov 18 17:26:37 2003
@@ -21,7 +21,7 @@
 from zope.app.traversing import traverse
 from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.component import getAdapter
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.app.interfaces.copypastemove import IObjectMover
 from zope.app.interfaces.container import IContainer
 from zope.app.copypastemove import ObjectMover
@@ -34,7 +34,7 @@
     def setUp(self):
         PlacefulSetup.setUp(self)
         PlacefulSetup.buildFolders(self)
-        provideAdapter(None, IObjectMover, ObjectMover)
+        ztapi.provideAdapter(None, IObjectMover, ObjectMover)
 
     def test_simplerename(self):
         root = self.rootFolder


=== Zope3/src/zope/app/tests/ztapi.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/tests/ztapi.py:1.1.2.1	Mon Nov 10 10:00:42 2003
+++ Zope3/src/zope/app/tests/ztapi.py	Tue Nov 18 17:26:37 2003
@@ -17,7 +17,7 @@
 """
 from zope.app import zapi
 import zope.interface
-from zope.component.servicenames import Presentation
+from zope.component.servicenames import Presentation, Adapters
 from zope.publisher.browser import IBrowserRequest
 
 def browserView(for_, name, factory, layer='default'):
@@ -36,4 +36,11 @@
 def setDefaultViewName(for_, name, layer='default'):
     s = zapi.getService(None, Presentation)
     s.setDefaultViewName(for_, IBrowserRequest, name, layer=layer)
+
+stypes = list, tuple
+def provideAdapter(required, provided, factory, name='', with=()):
+    s = zapi.getService(None, Adapters)
+    if not isinstance(factory, stypes):
+        factory = [factory]
+    s.provideAdapter(required, provided, factory, name, with)
     




More information about the Zope3-Checkins mailing list