Commit 56838bdd authored by Jim Fulton's avatar Jim Fulton

Changed transaction records to support multiple iteration.

parent f16879e1
...@@ -1626,8 +1626,7 @@ class FileIterator(FileStorageFormatter): ...@@ -1626,8 +1626,7 @@ class FileIterator(FileStorageFormatter):
raise ZODB.interfaces.StorageStopIteration() raise ZODB.interfaces.StorageStopIteration()
class TransactionRecord(BaseStorage.TransactionRecord, FileStorageFormatter): class TransactionRecord(BaseStorage.TransactionRecord):
"""Iterate over the transactions in a FileStorage file."""
def __init__(self, tid, status, user, desc, ext, pos, tend, file, tpos): def __init__(self, tid, status, user, desc, ext, pos, tend, file, tpos):
BaseStorage.TransactionRecord.__init__( BaseStorage.TransactionRecord.__init__(
...@@ -1637,6 +1636,18 @@ class TransactionRecord(BaseStorage.TransactionRecord, FileStorageFormatter): ...@@ -1637,6 +1636,18 @@ class TransactionRecord(BaseStorage.TransactionRecord, FileStorageFormatter):
self._file = file self._file = file
self._tpos = tpos self._tpos = tpos
def __iter__(self):
return TransactionRecordIterator(self)
class TransactionRecordIterator(FileStorageFormatter):
"""Iterate over the transactions in a FileStorage file."""
def __init__(self, record):
self._file = record._file
self._pos = record._pos
self._tpos = record._tpos
self._tend = record._tend
def __iter__(self): def __iter__(self):
return self return self
......
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