Commit ec1fec08 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Raise IOError when the iterator is closed.

As done in the FileStorage and expected by ZODB tests (see checkClose).

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1902 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 82465779
......@@ -80,12 +80,15 @@ class Iterator(object):
self.app = app
self.txn_list = []
self.index = 0
self._closed = False
def __iter__(self):
return self
def next(self):
""" Return an iterator for the next transaction"""
if self._closed:
raise IOError, 'iterator closed'
app = self.app
if not self.txn_list:
# ask some transactions
......@@ -107,4 +110,4 @@ class Iterator(object):
return 'NEO transactions iteratpr'
def close(self):
pass
self._closed = True
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