[Zope-Checkins] CVS: ZODB3/ZODB - FileStorage.py:1.105.2.18

Barry Warsaw barry@zope.com
Thu, 24 Jul 2003 14:48:00 -0400


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv7146/ZODB

Modified Files:
      Tag: ZODB3-3_1-branch
	FileStorage.py 
Log Message:
Back port a few changes from ZODB 3 head:

Add cleanup() which RecoveryStorage mixing requires.


=== ZODB3/ZODB/FileStorage.py 1.105.2.17 => 1.105.2.18 ===
--- ZODB3/ZODB/FileStorage.py:1.105.2.17	Fri May 16 16:38:58 2003
+++ ZODB3/ZODB/FileStorage.py	Thu Jul 24 14:47:55 2003
@@ -1557,6 +1557,11 @@
             raise CorruptedDataError, h
         return h[8:]
 
+    def cleanup(self):
+        """Remove all files created by this storage."""
+        cleanup(self._file_name)
+
+
 def shift_transactions_forward(index, vindex, tindex, file, pos, opos):
     """Copy transactions forward in the data file
 
@@ -2277,3 +2282,13 @@
              'description': d}
         d.update(e)
         return d
+
+
+def cleanup(filename):
+    """Remove all FileStorage related files."""
+    for ext in '', '.old', '.tmp', '.lock', '.index', '.pack':
+        try:
+            os.remove(filename + ext)
+        except OSError, e:
+            if e.errno != errno.ENOENT:
+                raise