[Zope3-checkins]
SVN: Zope3/branches/jim-adapter/src/zope/component/
Fixed a bug in persistently handling subscribers.
Jim Fulton
jim at zope.com
Mon Apr 24 13:35:03 EDT 2006
Log message for revision 67572:
Fixed a bug in persistently handling subscribers.
Changed:
U Zope3/branches/jim-adapter/src/zope/component/registry.py
U Zope3/branches/jim-adapter/src/zope/component/tests.py
-=-
Modified: Zope3/branches/jim-adapter/src/zope/component/registry.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/component/registry.py 2006-04-24 16:33:21 UTC (rev 67571)
+++ Zope3/branches/jim-adapter/src/zope/component/registry.py 2006-04-24 17:35:03 UTC (rev 67572)
@@ -273,7 +273,7 @@
return False
- self._subscription_registrations = new
+ self._subscription_registrations[:] = new
self.adapters.unsubscribe(required, provided)
zope.event.notify(interfaces.Unregistered(
@@ -330,7 +330,7 @@
if len(new) == len(self._handler_registrations):
return False
- self._handler_registrations = new
+ self._handler_registrations[:] = new
self.adapters.unsubscribe(required, None)
zope.event.notify(interfaces.Unregistered(
Modified: Zope3/branches/jim-adapter/src/zope/component/tests.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/component/tests.py 2006-04-24 16:33:21 UTC (rev 67571)
+++ Zope3/branches/jim-adapter/src/zope/component/tests.py 2006-04-24 17:35:03 UTC (rev 67572)
@@ -792,6 +792,41 @@
>>> db.close()
"""
+def persistent_registry_doesnt_scew_up_subsribers():
+ """
+ >>> import ZODB.tests.util
+ >>> db = ZODB.tests.util.DB()
+ >>> import transaction
+ >>> t1 = transaction.TransactionManager()
+ >>> c1 = db.open(transaction_manager=t1)
+ >>> r1 = c1.root()
+ >>> t2 = transaction.TransactionManager()
+ >>> c2 = db.open(transaction_manager=t2)
+ >>> r2 = c2.root()
+
+ >>> from zope.component.persistentregistry import PersistentComponents
+
+ >>> _ = t1.begin()
+ >>> r1[1] = PersistentComponents('1')
+ >>> r1[1].registerHandler(handle1)
+ >>> r1[1].registerSubscriptionAdapter(handle1, provided=I2)
+ >>> _ = r1[1].unregisterHandler(handle1)
+ >>> _ = r1[1].unregisterSubscriptionAdapter(handle1, provided=I2)
+ >>> t1.commit()
+ >>> _ = t1.begin()
+ >>> r1[1].registerHandler(handle1)
+ >>> r1[1].registerSubscriptionAdapter(handle1, provided=I2)
+ >>> t1.commit()
+
+ >>> _ = t2.begin()
+ >>> len(list(r2[1].registeredHandlers()))
+ 1
+ >>> len(list(r2[1].registeredSubscriptionAdapters()))
+ 1
+ >>> t2.abort()
+
+ """
+
def tearDownRegistryTests(tests):
import zope.event
zope.event.subscribers.pop()
More information about the Zope3-Checkins
mailing list