[Zope3-checkins] CVS: Zope3/src/zope/app/services - event.py:1.22

Steve Alexander steve@cat-box.net
Sat, 12 Apr 2003 07:52:48 -0400


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

Modified Files:
	event.py 
Log Message:
The hubIds service depends on the event service. So, add the hubIds service
after the event service.
Make the event channel (on which the event service depends) not require
a hubIds service.

So, most people's hubids services are not subscribed to their event
services. The easy way to fix this is to toss your Data.fs.
The fairly easy way to fix this is to go into the debugger, and subscribe
the service in the course of another transaction.
The pretty easy way to fix this is to make the hubids service disabled,
and then re-enabled.



=== Zope3/src/zope/app/services/event.py 1.21 => 1.22 ===
--- Zope3/src/zope/app/services/event.py:1.21	Sat Apr 12 07:42:08 2003
+++ Zope3/src/zope/app/services/event.py	Sat Apr 12 07:52:17 2003
@@ -84,7 +84,14 @@
 
     def _notify(clean_self, wrapped_self, event):
         subscriptionsForEvent = clean_self._registry.getAllForObject(event)
-        hubGet = getService(wrapped_self, HubIds).getObject
+        hubIdsService = queryService(wrapped_self, HubIds)
+        if hubIdsService is None:
+            # This will only happen if there is no HubIds service.
+            # This is only true at start-up, so we don't bother testing
+            # whether hubGet is None in the loop below.
+            hubGet = None
+        else:
+            hubGet = hubIdsService.getObject
         pathGet = getAdapter(wrapped_self, ITraverser).traverse
 
         badSubscribers = {}  # using a dict as a set