Commit 244d455f authored by Vincent Pelletier's avatar Vincent Pelletier

Allow iterating multiple times over transaction content.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2267 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent abe6055f
...@@ -58,12 +58,13 @@ class Transaction(BaseStorage.TransactionRecord): ...@@ -58,12 +58,13 @@ class Transaction(BaseStorage.TransactionRecord):
def next(self): def next(self):
""" Iterate over the transaction records """ """ Iterate over the transaction records """
app = self.app app = self.app
if not self.oid_list: oid_list = self.oid_list
oid_index = self.oid_index
if self.oid_index >= len(oid_list):
# no more records for this transaction # no more records for this transaction
self.oid_index = 0 self.oid_index = 0
raise StopIteration raise StopIteration
oid_index = self.oid_index oid = oid_list[oid_index]
oid = self.oid_list[oid_index]
self.oid_index = oid_index + 1 self.oid_index = oid_index + 1
# load an object # load an object
data, _, next_tid = app._load(oid, serial=self.tid) data, _, next_tid = app._load(oid, serial=self.tid)
......
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