[Checkins] SVN: zope.component/branches/wichert-utility-factories/src/zope/component/registry.py Correct utility subscription logic. This fixes problems with utilities leaving subscriptions when being unregistered.

Wichert Akkerman wichert at wiggy.net
Wed Jul 23 08:57:45 EDT 2008


Log message for revision 88759:
  Correct utility subscription logic. This fixes problems with utilities leaving subscriptions when being unregistered.

Changed:
  U   zope.component/branches/wichert-utility-factories/src/zope/component/registry.py

-=-
Modified: zope.component/branches/wichert-utility-factories/src/zope/component/registry.py
===================================================================
--- zope.component/branches/wichert-utility-factories/src/zope/component/registry.py	2008-07-23 11:53:05 UTC (rev 88758)
+++ zope.component/branches/wichert-utility-factories/src/zope/component/registry.py	2008-07-23 12:57:44 UTC (rev 88759)
@@ -92,11 +92,11 @@
                     break
 
         self._utility_registrations[(provided, name)] = component, info, factory
-        if hasattr(self, '_utility_subscribers'):
-            self._utility_subscribers[(provided, component)] = True
         self.utilities.register((), provided, name, component)
 
         if not subscribed:
+            if hasattr(self, '_utility_subscribers'):
+                self._utility_subscribers[(provided, component)] = True
             self.utilities.subscribe((), provided, component)
 
         if event:



More information about the Checkins mailing list