[Zodb-checkins] SVN: ZODB/trunk/src/Z Deprecated ZODB.interfaces.StorageStopIteration. Storage
Jim Fulton
jim at zope.com
Tue May 18 11:22:10 EDT 2010
Log message for revision 112460:
Deprecated ZODB.interfaces.StorageStopIteration. Storage
iterator implementations should just raise StopIteration, which
means they can now be implemented as generators.
Changed:
U ZODB/trunk/src/ZEO/ClientStorage.py
U ZODB/trunk/src/ZODB/tests/IteratorStorage.py
U ZODB/trunk/src/ZODB/tests/testMappingStorage.py
-=-
Modified: ZODB/trunk/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/trunk/src/ZEO/ClientStorage.py 2010-05-18 15:22:07 UTC (rev 112459)
+++ ZODB/trunk/src/ZEO/ClientStorage.py 2010-05-18 15:22:09 UTC (rev 112460)
@@ -1530,7 +1530,7 @@
def next(self):
if self._ended:
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
if self._iid < 0:
raise ClientDisconnected("Disconnected iterator")
@@ -1541,7 +1541,7 @@
# disposed it.
self._ended = True
self._storage._forget_iterator(self._iid)
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
return ClientStorageTransactionInformation(
self._storage, self, *tx_data)
@@ -1582,13 +1582,13 @@
if self._completed:
# We finished iteration once already and the server can't know
# about the iteration anymore.
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
item = self._storage._server.iterator_record_next(self._riid)
if item is None:
# The iterator is exhausted, and the server has already
# disposed it.
self._completed = True
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
return ZODB.BaseStorage.DataRecord(*item)
Modified: ZODB/trunk/src/ZODB/tests/IteratorStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/IteratorStorage.py 2010-05-18 15:22:07 UTC (rev 112459)
+++ ZODB/trunk/src/ZODB/tests/IteratorStorage.py 2010-05-18 15:22:09 UTC (rev 112460)
@@ -229,13 +229,9 @@
# meaning they were the same length.
# Additionally, check that we're backwards compatible to the
# IndexError we used to raise before.
- self.assertRaises(IndexError, itxn1.next)
- self.assertRaises(IndexError, itxn2.next)
self.assertRaises(StopIteration, itxn1.next)
self.assertRaises(StopIteration, itxn2.next)
# Make sure ther are no more records left in txn1 and txn2, meaning
# they were the same length
- self.assertRaises(IndexError, iter1.next)
- self.assertRaises(IndexError, iter2.next)
self.assertRaises(StopIteration, iter1.next)
self.assertRaises(StopIteration, iter2.next)
Modified: ZODB/trunk/src/ZODB/tests/testMappingStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testMappingStorage.py 2010-05-18 15:22:07 UTC (rev 112459)
+++ ZODB/trunk/src/ZODB/tests/testMappingStorage.py 2010-05-18 15:22:09 UTC (rev 112460)
@@ -13,6 +13,7 @@
##############################################################################
import ZODB.MappingStorage
import unittest
+import ZODB.tests.hexstorage
from ZODB.tests import (
@@ -48,13 +49,21 @@
# doesnt support huge transaction metadata. This storage doesnt
# have this limit, so we inhibit this test here.
pass
-
+
def checkLoadBeforeUndo(self):
pass # we don't support undo yet
checkUndoZombie = checkLoadBeforeUndo
+class MappingStorageHexTests(MappingStorageTests):
+
+ def setUp(self):
+ StorageTestBase.StorageTestBase.setUp(self, )
+ self._storage = ZODB.tests.hexstorage.HexStorage(
+ ZODB.MappingStorage.MappingStorage())
+
def test_suite():
suite = unittest.makeSuite(MappingStorageTests, 'check')
+ suite = unittest.makeSuite(MappingStorageHexTests, 'check')
return suite
if __name__ == "__main__":
More information about the Zodb-checkins
mailing list