[Neo-report] r1902 gregory - /trunk/neo/client/iterator.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 5 22:23:59 CET 2010


Author: gregory
Date: Fri Mar  5 22:23:58 2010
New Revision: 1902

Log:
Raise IOError when the iterator is closed.

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

Modified:
    trunk/neo/client/iterator.py

Modified: trunk/neo/client/iterator.py
==============================================================================
--- trunk/neo/client/iterator.py [iso-8859-1] (original)
+++ trunk/neo/client/iterator.py [iso-8859-1] Fri Mar  5 22:23:58 2010
@@ -80,12 +80,15 @@
         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 @@
         return 'NEO transactions iteratpr'
 
     def close(self):
-        pass
+        self._closed = True





More information about the Neo-report mailing list