[Zodb-checkins] CVS: Zope/lib/python/ZODB - FileStorage.py:1.60.8.1

Shane Hathaway shane@digicool.com
Thu, 9 Aug 2001 13:34:15 -0400


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv29115/lib/python/ZODB

Modified Files:
      Tag: NR-branch
	FileStorage.py 
Log Message:
Sync NR-branch with trunk.  Sorry about so many checkin messages...


=== Zope/lib/python/ZODB/FileStorage.py 1.60 => 1.60.8.1 ===
     def close(self):
         self._file.close()
-        self._lock_file.close()
-        self._tfile.close()
+        if hasattr(self,'_lock_file'):  self._lock_file.close()
+        if self._tfile:                 self._tfile.close()
         try: self._save_index()
         except: pass # We don't care if this fails.
         
@@ -1215,20 +1215,21 @@
         stop=`apply(TimeStamp, time.gmtime(t)[:5]+(t%60,))`
         if stop==z64: raise FileStorageError, 'Invalid pack time'
 
+        # Record pack time so we don't undo while packing
+        _lock_acquire()
         try:
-            ##################################################################
-            # Step 1, get index as of pack time that
-            # includes only referenced objects.
-
-            # Record pack time so we don't undo while packing
-            _lock_acquire()
-            locked=1
             if self._packt != z64:
+                # Already packing.
                 raise FileStorageError, 'Already packing'
             self._packt=stop
+        finally:
             _lock_release()
-            locked=0
-            
+
+        try:
+            ##################################################################
+            # Step 1, get index as of pack time that
+            # includes only referenced objects.
+
             packpos, maxoid, ltid = read_index(
                 file, name, index, vindex, tindex, stop,
                 read_only=1,