[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - objecthubsetup.py:1.13

Jim Fulton jim at zope.com
Sun Sep 21 13:33:09 EDT 2003


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

Modified Files:
	objecthubsetup.py 
Log Message:
Changed to use __setitem__ rather than setObject

Refactored the way locations are modeled in events.


=== Zope3/src/zope/app/services/tests/objecthubsetup.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/services/tests/objecthubsetup.py:1.12	Sat Jun  7 03:23:52 2003
+++ Zope3/src/zope/app/services/tests/objecthubsetup.py	Sun Sep 21 13:33:07 2003
@@ -22,7 +22,7 @@
 from zope.app.services.servicenames import HubIds
 from zope.app.traversing import traverse, canonicalPath
 
-from zope.app.interfaces.event import IObjectAddedEvent, IObjectMovedEvent
+from zope.app.interfaces.container import IObjectAddedEvent, IObjectMovedEvent
 from zope.app.interfaces.event import ISubscriber
 
 from zope.interface import implements
@@ -59,7 +59,7 @@
             location = canonicalPath(location)
             testcase.assert_(interface.isImplementedBy(event),
                              'Interface %s' % interface.getName())
-            testcase.assertEqual(event.location, location)
+            testcase.assertEqual(canonicalPath(event.object), location)
 
             if obj is not None:
                 testcase.assertEqual(event.object, obj)
@@ -79,21 +79,20 @@
     def notify(self, event):
         LoggingSubscriber.notify(self, event)
         # The policy is to register on object adds and object copies.
-        if (IObjectAddedEvent.isImplementedBy(event)
-            and not IObjectMovedEvent.isImplementedBy(event)):
-            self.hub.register(event.location)
+        if IObjectAddedEvent.isImplementedBy(event):
+            self.hub.register(event.object)
 
 class ObjectHubSetup(EventSetup):
 
     def setUpRegistrationSubscriber(self):
         subscriber = RegistrationSubscriber(self.object_hub)
-        self.rootFolder.setObject('registration_subscriber', subscriber)
+        self.rootFolder['registration_subscriber'] = subscriber
         self.subscriber = traverse(self.rootFolder, 'registration_subscriber')
         self.object_hub.subscribe(self.subscriber)
 
     def setUpLoggingSubscriber(self):
         subscriber = LoggingSubscriber()
-        self.rootFolder.setObject('logging_subscriber', subscriber)
+        self.rootFolder['logging_subscriber'] = subscriber
         self.subscriber = traverse(self.rootFolder, 'logging_subscriber')
         self.object_hub.subscribe(self.subscriber)
 




More information about the Zope3-Checkins mailing list