[Zope3-checkins] CVS: Zope3/src/zope/app/event - subs.py:1.8

Gary Poster gary@zope.com
Thu, 13 Feb 2003 22:18:34 -0500


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

Modified Files:
	subs.py 
Log Message:
 fixed bootstrap bug found by Sean Upton: subscription service can't assume presence of HubIds service.




=== Zope3/src/zope/app/event/subs.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/event/subs.py:1.7	Tue Feb 11 21:17:21 2003
+++ Zope3/src/zope/app/event/subs.py	Thu Feb 13 22:18:03 2003
@@ -33,6 +33,7 @@
 from zope.app.interfaces.event import ISubscribingAware
 
 from zope.component import getService, getAdapter, queryAdapter
+from zope.component import ComponentLookupError
 from zope.app.services.servicenames import HubIds
 from zope.app.services.type import PersistentTypeRegistry
 from cPickle import dumps, PicklingError
@@ -513,20 +514,28 @@
         else:
             cleanobj = removeAllProxies(wrappedobj)
             if allways:
-                hub = getService(context, HubIds)
-                try:
-                    hubId = hub.getHubId(path)
-                except NotFoundError:
-                    pass
+	        try:
+                    hub = getService(context, HubIds)
+		except ComponentLookupError:
+		    pass
+		else:
+                    try:
+                        hubId = hub.getHubId(path)
+                    except NotFoundError:
+                        pass
     else:
         reftype = object
         wrappedobj = reference
         cleanobj = clean_reference
         path = getPhysicalPathString(wrappedobj)
-        hub = getService(context, HubIds)
-        try:
-            hubId = hub.getHubId(path)
-        except NotFoundError:
-            pass
+	try:
+            hub = getService(context, HubIds)
+	except ComponentLookupError:
+	    pass
+	else:
+            try:
+                hubId = hub.getHubId(path)
+            except NotFoundError:
+                pass
 
     return cleanobj, wrappedobj, path, hubId, reftype