[Zodb-checkins] SVN: ZODB/branches/jim-transform-wrapping/src/Z stop using StorageStopIteration
Jim Fulton
jim at zope.com
Mon May 17 15:19:43 EDT 2010
Log message for revision 112426:
stop using StorageStopIteration
Changed:
U ZODB/branches/jim-transform-wrapping/src/ZEO/ClientStorage.py
U ZODB/branches/jim-transform-wrapping/src/ZODB/FileStorage/FileStorage.py
U ZODB/branches/jim-transform-wrapping/src/ZODB/tests/IteratorStorage.py
U ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py
-=-
Modified: ZODB/branches/jim-transform-wrapping/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/jim-transform-wrapping/src/ZEO/ClientStorage.py 2010-05-17 18:23:26 UTC (rev 112425)
+++ ZODB/branches/jim-transform-wrapping/src/ZEO/ClientStorage.py 2010-05-17 19:19:42 UTC (rev 112426)
@@ -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/branches/jim-transform-wrapping/src/ZODB/FileStorage/FileStorage.py
===================================================================
--- ZODB/branches/jim-transform-wrapping/src/ZODB/FileStorage/FileStorage.py 2010-05-17 18:23:26 UTC (rev 112425)
+++ ZODB/branches/jim-transform-wrapping/src/ZODB/FileStorage/FileStorage.py 2010-05-17 19:19:42 UTC (rev 112426)
@@ -1763,7 +1763,7 @@
def next(self):
if self._file is None:
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
pos = self._pos
while True:
@@ -1852,7 +1852,7 @@
return result
self.close()
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
class TransactionRecord(BaseStorage.TransactionRecord):
@@ -1911,7 +1911,7 @@
return Record(h.oid, h.tid, data, prev_txn, pos)
- raise ZODB.interfaces.StorageStopIteration()
+ raise StopIteration()
class Record(BaseStorage.DataRecord):
Modified: ZODB/branches/jim-transform-wrapping/src/ZODB/tests/IteratorStorage.py
===================================================================
--- ZODB/branches/jim-transform-wrapping/src/ZODB/tests/IteratorStorage.py 2010-05-17 18:23:26 UTC (rev 112425)
+++ ZODB/branches/jim-transform-wrapping/src/ZODB/tests/IteratorStorage.py 2010-05-17 19:19:42 UTC (rev 112426)
@@ -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/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py
===================================================================
--- ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py 2010-05-17 18:23:26 UTC (rev 112425)
+++ ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py 2010-05-17 19:19:42 UTC (rev 112426)
@@ -15,21 +15,6 @@
import ZODB.interfaces
import zope.interface
-class MadIterator(object):
-
- def __init__(self, it):
- self.it = it
-
- def __iter__(self):
- return self
-
- def next(self):
- try:
- return self.it.next()
- except StopIteration:
- raise ZODB.interfaces.StorageStopIteration()
-
-
class HexStorage(object):
zope.interface.implements(ZODB.interfaces.IStorageWrapper)
@@ -100,7 +85,7 @@
for t in self.base.iterator(start, stop):
yield Transaction(self, t)
- return MadIterator(it(start, stop))
+ return it(start, stop)
def storeBlob(self, oid, oldserial, data, blobfilename, version,
@@ -154,14 +139,11 @@
self.__trans = trans
def __iter__(self):
- def it(self):
- for r in self.__trans:
- if r.data:
- r.data = self.__store.untransform_record_data(r.data)
- yield r
+ for r in self.__trans:
+ if r.data:
+ r.data = self.__store.untransform_record_data(r.data)
+ yield r
- return MadIterator(it(self))
-
def __getattr__(self, name):
return getattr(self.__trans, name)
More information about the Zodb-checkins
mailing list