[Zodb-checkins] SVN: ZODB/trunk/s removed dependency on zope.event, while retaining zope.event support
Jim Fulton
jim at zope.com
Fri Nov 18 11:40:55 UTC 2011
Log message for revision 123420:
removed dependency on zope.event, while retaining zope.event support
Changed:
U ZODB/trunk/setup.py
U ZODB/trunk/src/CHANGES.txt
U ZODB/trunk/src/ZEO/ClientStorage.py
U ZODB/trunk/src/ZEO/tests/drop_cache_rather_than_verify.txt
U ZODB/trunk/src/ZODB/tests/testZODB.py
-=-
Modified: ZODB/trunk/setup.py
===================================================================
--- ZODB/trunk/setup.py 2011-11-18 10:41:45 UTC (rev 123419)
+++ ZODB/trunk/setup.py 2011-11-18 11:40:54 UTC (rev 123420)
@@ -197,7 +197,6 @@
'zc.lockfile',
'ZConfig',
'zdaemon',
- 'zope.event',
'zope.interface',
],
zip_safe = False,
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2011-11-18 10:41:45 UTC (rev 123419)
+++ ZODB/trunk/src/CHANGES.txt 2011-11-18 11:40:54 UTC (rev 123420)
@@ -5,6 +5,14 @@
3.11.0 (2010-??-??)
===================
+New Features
+------------
+
+- ZODB no-longer depends on zope.event. It now uses ZODB.event, which
+ uses zope.event if it is installed. You can override
+ ZODB.event.notify to provide your own event handling, although
+ zope.event is recommended.
+
Bugs Fixed
----------
Modified: ZODB/trunk/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/trunk/src/ZEO/ClientStorage.py 2011-11-18 10:41:45 UTC (rev 123419)
+++ ZODB/trunk/src/ZEO/ClientStorage.py 2011-11-18 11:40:54 UTC (rev 123420)
@@ -46,7 +46,7 @@
import ZODB
import ZODB.BaseStorage
import ZODB.interfaces
-import zope.event
+import ZODB.event
import zope.interface
logger = logging.getLogger(__name__)
@@ -1384,7 +1384,7 @@
self._cache.setLastTid(server_tid)
- zope.event.notify(ZEO.interfaces.StaleCache(self))
+ ZODB.event.notify(ZEO.interfaces.StaleCache(self))
# From this point on, we do not have complete information about
# the missed transactions. The reason is that cache
Modified: ZODB/trunk/src/ZEO/tests/drop_cache_rather_than_verify.txt
===================================================================
--- ZODB/trunk/src/ZEO/tests/drop_cache_rather_than_verify.txt 2011-11-18 10:41:45 UTC (rev 123419)
+++ ZODB/trunk/src/ZEO/tests/drop_cache_rather_than_verify.txt 2011-11-18 11:40:54 UTC (rev 123420)
@@ -56,15 +56,17 @@
Now, we'll restart the server. Before we do that, we'll capture
logging and event data:
- >>> import logging, zope.testing.loggingsupport, zope.event
+ >>> import logging, zope.testing.loggingsupport, ZODB.event
>>> handler = zope.testing.loggingsupport.InstalledHandler(
... 'ZEO.ClientStorage', level=logging.ERROR)
>>> events = []
>>> def event_handler(e):
... events.append((
... len(e.storage._cache), str(handler), e.__class__.__name__))
- >>> zope.event.subscribers.append(event_handler)
+ >>> old_notify = ZODB.event.notify
+ >>> ZODB.event.notify = event_handler
+
Note that the event handler is saving away the length of the cache and
the state of the log handler. We'll use this to show that the event
is generated before the cache is dropped or the message is logged.
@@ -213,4 +215,4 @@
>>> db.close()
>>> handler.uninstall()
- >>> zope.event.subscribers.remove(event_handler)
+ >>> ZODB.event.notify = old_notify
Modified: ZODB/trunk/src/ZODB/tests/testZODB.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testZODB.py 2011-11-18 10:41:45 UTC (rev 123419)
+++ ZODB/trunk/src/ZODB/tests/testZODB.py 2011-11-18 11:40:54 UTC (rev 123420)
@@ -17,6 +17,7 @@
from ZODB.POSException import ReadConflictError
from ZODB.POSException import TransactionFailedError
+import doctest
import transaction
import unittest
import ZODB
@@ -611,8 +612,10 @@
self._p_jar = poisonedjar
def test_suite():
- suite = unittest.makeSuite(ZODBTests, 'check')
- return suite
+ return unittest.TestSuite((
+ unittest.makeSuite(ZODBTests, 'check'),
+ doctest.DocTestSuite('ZODB.event'),
+ ))
if __name__ == "__main__":
unittest.main(defaultTest="test_suite")
More information about the Zodb-checkins
mailing list