[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.77.4.3

Guido van Rossum guido@python.org
Thu, 24 Jan 2002 02:40:20 -0500


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv21726

Modified Files:
      Tag: Recovery
	FileStorage.py 
Log Message:
Add an explicit close() method to the FileIterator class.  This should
become a standard part of the iterator protocol!


=== StandaloneZODB/ZODB/FileStorage.py 1.77.4.2 => 1.77.4.3 ===
     """
     _ltid=z64
+
+    _file = None
     
     def __init__(self, file, start=None, stop=None):
         if isinstance(file, StringType):
@@ -2097,6 +2099,12 @@
         if start:
             self._skip_to_start(start)
         self._stop = stop
+
+    def close(self):
+        file = self._file
+        if file is not None:
+            self._file = None
+            file.close()
 
     def _skip_to_start(self, start):
         # Scan through the transaction records doing almost no sanity