[Zope3-checkins] SVN: Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/placelesssetup.py Converted the testing event recorder to a handler.

Jim Fulton jim at zope.com
Wed May 26 07:23:43 EDT 2004


Log message for revision 24996:
Converted the testing event recorder to a handler.

Got rid of the event services.



-=-
Modified: Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/placelesssetup.py
===================================================================
--- Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/placelesssetup.py	2004-05-26 11:23:19 UTC (rev 24995)
+++ Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/placelesssetup.py	2004-05-26 11:23:43 UTC (rev 24996)
@@ -15,22 +15,17 @@
 
 $Id$
 """
-from zope.app.servicenames import EventPublication
-from zope.app.event.interfaces import IPublisher, ISubscriber, IObjectEvent
-from zope.app.event.globalservice import eventPublisher
+
+from zope.app.event.interfaces import IObjectEvent
 from zope.app.event.objectevent import objectEventNotifierInstance
 from zope.interface import implements
 from zope.component import getGlobalServices
 
 events = []
 
-class EventRecorderClass:
-    implements(ISubscriber)
+def record(event):
+    events.append(event)
 
-    notify = events.append
-
-EventRecorder = EventRecorderClass()
-
 def getEvents(event_type=None, filter=None):
     r = []
     for event in events:
@@ -48,17 +43,8 @@
 class PlacelessSetup:
 
     def setUp(self):
-        sm = getGlobalServices()
-        defineService = sm.defineService
-        provideService = sm.provideService
-
-        defineService(EventPublication, IPublisher)
-        provideService(EventPublication, eventPublisher)
-
         clearEvents()
-        eventPublisher.globalSubscribe(EventRecorder)
-        eventPublisher.globalSubscribe(objectEventNotifierInstance,
-                                       IObjectEvent)
+        ztapi.subscribe([None], None, record)
 
 import zope.testing.cleanup
 zope.testing.cleanup.addCleanUp(clearEvents)




More information about the Zope3-Checkins mailing list