[Zodb-checkins] CVS: Zope3/src/zodb/storage - file.py:1.11

Barry Warsaw barry@wooz.org
Thu, 27 Feb 2003 18:19:24 -0500


Update of /cvs-repository/Zope3/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv14770

Modified Files:
	file.py 
Log Message:
_lock(): Use the new LockFile class.


=== Zope3/src/zodb/storage/file.py 1.10 => 1.11 ===
--- Zope3/src/zodb/storage/file.py:1.10	Tue Feb 25 13:55:03 2003
+++ Zope3/src/zodb/storage/file.py	Thu Feb 27 18:19:20 2003
@@ -152,7 +152,7 @@
 from zodb.interfaces import UndoError, POSKeyError, MultipleUndoErrors
 from zodb.serialize import findrefs
 from zodb.timestamp import TimeStamp, newTimeStamp, timeStampFromTime
-from zodb.lockfile import lock_file
+from zodb.lockfile import LockFile
 from zodb.utils import p64, u64, cp, z64
 from zodb.storage.fsindex import fsIndex
 from zodb.storage.interfaces import *
@@ -566,17 +566,7 @@
         self._quota = quota
 
     def _lock(self):
-        try:
-            f = open(self._name + '.lock', 'r+')
-        except:
-            f = open(self._name + '.lock', 'w+')
-        lock_file(f)
-        try:
-            f.write(str(os.getpid()))
-            f.flush()
-        except:
-            pass
-        self._lock_file = f # so it stays open
+        self._lock_file = LockFile(self._name + '.lock')
 
     def _initIndex(self, index=None, vindex=None, tindex=None, tvindex=None):
         self._index = index or fsIndex()