[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ remove appearances of ztapi.handle

Philipp von Weitershausen philikon at philikon.de
Sat Jun 25 12:58:29 EDT 2005


Log message for revision 30927:
  remove appearances of ztapi.handle
  

Changed:
  U   Zope3/trunk/src/zope/app/container/contained.py
  U   Zope3/trunk/src/zope/app/copypastemove/__init__.py
  U   Zope3/trunk/src/zope/app/event/dispatching.py
  U   Zope3/trunk/src/zope/app/event/tests/placelesssetup.py
  U   Zope3/trunk/src/zope/app/event/tests/test_objectevent.py
  U   Zope3/trunk/src/zope/app/intid/tests.py
  U   Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py

-=-
Modified: Zope3/trunk/src/zope/app/container/contained.py
===================================================================
--- Zope3/trunk/src/zope/app/container/contained.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/container/contained.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -143,11 +143,12 @@
        Now we'll register it:
 
          >>> from zope.app.testing import ztapi
-         >>> ztapi.handle([None, IObjectMovedEvent], handler)
+         >>> ztapi.subscribe([None, IObjectMovedEvent], None, handler)
 
        We also register our dispatcher:
 
-         >>> ztapi.handle([None, IObjectMovedEvent], dispatchToSublocations)
+         >>> ztapi.subscribe([None, IObjectMovedEvent], None,
+         ...                 dispatchToSublocations)
 
        We can then call the dispatcher for the root object:
 
@@ -377,11 +378,11 @@
     >>> from zope.app.container.interfaces import IObjectMovedEvent
     >>> from zope.app.testing import ztapi
 
-    >>> ztapi.handle([IItem, IObjectAddedEvent],
-    ...              lambda obj, event: obj.setAdded(event))
+    >>> ztapi.subscribe([IItem, IObjectAddedEvent], None,
+    ...                 lambda obj, event: obj.setAdded(event))
 
-    >>> ztapi.handle([IItem, IObjectMovedEvent],
-    ...              lambda obj, event: obj.setMoved(event))
+    >>> ztapi.subscribe([IItem, IObjectMovedEvent], None,
+    ...                 lambda obj, event: obj.setMoved(event))
 
     >>> item = Item()
 

Modified: Zope3/trunk/src/zope/app/copypastemove/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/__init__.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/copypastemove/__init__.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -679,11 +679,12 @@
 
       >>> from zope.app.tests import ztapi
       >>> from zope.app.event.interfaces import IObjectCopiedEvent
-      >>> ztapi.handle([None, IObjectCopiedEvent], handler)
+      >>> ztapi.subscribe([None, IObjectCopiedEvent], None, handler)
 
     and this function as a dispatcher:
 
-      >>> ztapi.handle([None, IObjectCopiedEvent], dispatchToSublocations)
+      >>> ztapi.subscribe([None, IObjectCopiedEvent], None,
+      ...                 dispatchToSublocations)
 
     When we notify that our root object has been copied:
 

Modified: Zope3/trunk/src/zope/app/event/dispatching.py
===================================================================
--- Zope3/trunk/src/zope/app/event/dispatching.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/event/dispatching.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -36,8 +36,8 @@
 
   >>> from zope.app.testing import ztapi
   >>> from zope.interface import implementedBy
-  >>> ztapi.handle([implementedBy(E1)], handler1) # old way
-  >>> ztapi.handle((E2,), handler2) # new way
+  >>> ztapi.subscribe([implementedBy(E1)], None, handler1) # old way
+  >>> ztapi.subscribe((E2,), None, handler2) # new way
 
   >>> from zope.event import notify
 
@@ -62,6 +62,7 @@
 import zope.event
 
 def dispatch(*event):
+    # iterating over subscribers assures they get executed
     for ignored in subscribers(event, None):
         pass
 

Modified: Zope3/trunk/src/zope/app/event/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/placelesssetup.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/event/tests/placelesssetup.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -40,8 +40,8 @@
 
     def setUp(self):
         clearEvents()
-        ztapi.handle([None], events.append)
-        ztapi.handle([IObjectEvent], objectEventNotify)
+        ztapi.subscribe([None], None, events.append)
+        ztapi.subscribe([IObjectEvent], None, objectEventNotify)
 
 import zope.testing.cleanup
 zope.testing.cleanup.addCleanUp(clearEvents)

Modified: Zope3/trunk/src/zope/app/event/tests/test_objectevent.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/test_objectevent.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/event/tests/test_objectevent.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -70,7 +70,7 @@
         def record(*args):
             events.append(args)
 
-        ztapi.handle([IContained, IObjectRemovedEvent], record)
+        ztapi.subscribe([IContained, IObjectRemovedEvent], None, record)
 
         item = Contained()
         event = ObjectRemovedEvent(item)
@@ -87,7 +87,7 @@
         self.assertEqual([], events)
 
     def testVeto(self):
-        ztapi.handle([IObjectEvent], objectevent.objectEventNotify)
+        ztapi.subscribe([IObjectEvent], None, objectevent.objectEventNotify)
         container = SampleContainer()
         item = Contained()
 
@@ -102,7 +102,7 @@
             self.assertEqual(item, event.object)
             raise Veto
 
-        ztapi.handle([IContained, IObjectRemovedEvent], callback)
+        ztapi.subscribe([IContained, IObjectRemovedEvent], None, callback)
 
         # del container['Fred'] will fire an ObjectRemovedEvent event.
         self.assertRaises(Veto, container.__delitem__, 'Fred')

Modified: Zope3/trunk/src/zope/app/intid/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/tests.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/intid/tests.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -189,7 +189,7 @@
         setSite(self.folder1_1)
 
         events = []
-        ztapi.handle([IIntIdRemovedEvent], events.append)
+        ztapi.subscribe([IIntIdRemovedEvent], None, events.append)
 
         # This should unregister the object in all utilities, not just the
         # nearest one.
@@ -211,7 +211,7 @@
         setSite(self.folder1_1)
 
         events = []
-        ztapi.handle([IIntIdAddedEvent], events.append)
+        ztapi.subscribe([IIntIdAddedEvent], None, events.append)
 
         # This should register the object in all utilities, not just the
         # nearest one.

Modified: Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -213,8 +213,8 @@
     def test_registerAddSubscriber_template(self):
         ztapi.provideAdapter(ILocation, IPhysicallyLocatable,
                              PhonyPathAdapter)
-        ztapi.handle((IPageRegistration, IObjectAddedEvent),
-                     PageRegistrationAddSubscriber)
+        ztapi.subscribe((IPageRegistration, IObjectAddedEvent), None,
+                        PageRegistrationAddSubscriber)
         registration = PageRegistration(I1, 'test', 'zope.View', "Foo.Bar.A",
                                         template=self.__template)
         
@@ -226,8 +226,8 @@
     def test_registerRemoveSubscriber_template(self):
         ztapi.provideAdapter(ILocation, IPhysicallyLocatable,
                              PhonyPathAdapter)
-        ztapi.handle((IPageRegistration, IObjectRemovedEvent),
-                     PageRegistrationRemoveSubscriber)
+        ztapi.subscribe((IPageRegistration, IObjectRemovedEvent), None,
+                        PageRegistrationRemoveSubscriber)
         registration = PageRegistration(I1, 'test', 'zope.View', "Foo.Bar.A",
                                         template=self.__template)
 

Modified: Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2005-06-25 16:58:01 UTC (rev 30926)
+++ Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2005-06-25 16:58:29 UTC (rev 30927)
@@ -484,8 +484,8 @@
 
         set = []
         clear = []
-        ztapi.handle([IBeforeTraverseEvent], set.append)
-        ztapi.handle([IEndRequestEvent], clear.append)
+        ztapi.subscribe([IBeforeTraverseEvent], None, set.append)
+        ztapi.subscribe([IEndRequestEvent], None, clear.append)
 
         ob = object()
 



More information about the Zope3-Checkins mailing list