[Checkins] SVN: zope.component/trunk/src/zope/component/registry.py
Slightly optimized un/registerUtility for already existing
subscribers.
Hanno Schlichting
plone at hannosch.info
Sat Oct 27 12:53:07 EDT 2007
Log message for revision 81137:
Slightly optimized un/registerUtility for already existing subscribers.
Changed:
U zope.component/trunk/src/zope/component/registry.py
-=-
Modified: zope.component/trunk/src/zope/component/registry.py
===================================================================
--- zope.component/trunk/src/zope/component/registry.py 2007-10-27 16:12:26 UTC (rev 81136)
+++ zope.component/trunk/src/zope/component/registry.py 2007-10-27 16:53:07 UTC (rev 81137)
@@ -75,11 +75,11 @@
# already registered
return
- subscribed = [
- 1
- for ((p, _), (c,_)) in self._utility_registrations.iteritems()
- if p == provided and c == component
- ]
+ subscribed = False
+ for ((p, _), (c,_)) in self._utility_registrations.iteritems():
+ if p == provided and c == component:
+ subscribed = True
+ break
self._utility_registrations[(provided, name)] = component, info
self.utilities.register((), provided, name, component)
@@ -108,11 +108,11 @@
del self._utility_registrations[(provided, name)]
self.utilities.unregister((), provided, name)
- subscribed = [
- 1
- for ((p, _), (c,_)) in self._utility_registrations.iteritems()
- if p == provided and c == component
- ]
+ subscribed = False
+ for ((p, _), (c,_)) in self._utility_registrations.iteritems():
+ if p == provided and c == component:
+ subscribed = True
+ break
if not subscribed:
self.utilities.unsubscribe((), provided, component)
More information about the Checkins
mailing list