Commit a1d670b4 authored by Jim Fulton's avatar Jim Fulton

removed dependency on zope.event, while retaining zope.event support

parent 3f45f568
......@@ -197,7 +197,6 @@ setup(name="ZODB3",
'zc.lockfile',
'ZConfig',
'zdaemon',
'zope.event',
'zope.interface',
],
zip_safe = False,
......
......@@ -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
----------
......
......@@ -46,7 +46,7 @@ import ZEO.interfaces
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 @@ class ClientStorage(object):
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
......
......@@ -56,14 +56,16 @@ And create another client and write some data to it:
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
......@@ -213,4 +215,4 @@ invalidated during verification.
>>> db.close()
>>> handler.uninstall()
>>> zope.event.subscribers.remove(event_handler)
>>> ZODB.event.notify = old_notify
......@@ -17,6 +17,7 @@ from persistent.mapping import PersistentMapping
from ZODB.POSException import ReadConflictError
from ZODB.POSException import TransactionFailedError
import doctest
import transaction
import unittest
import ZODB
......@@ -611,8 +612,10 @@ class PoisonedObject:
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")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment