[Zodb-checkins] CVS: ZODB3/ZODB - FileStorage.py:1.127
Barry Warsaw
barry@wooz.org
Fri, 28 Feb 2003 14:51:00 -0500
Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv6556
Modified Files:
FileStorage.py
Log Message:
Backported from ZODB4, use the lock_file.LockFile class to
encapsulation the storage lock file.
=== ZODB3/ZODB/FileStorage.py 1.126 => 1.127 ===
--- ZODB3/ZODB/FileStorage.py:1.126 Tue Feb 4 12:16:19 2003
+++ ZODB3/ZODB/FileStorage.py Fri Feb 28 14:50:59 2003
@@ -135,7 +135,7 @@
from ZODB import BaseStorage, ConflictResolution, POSException
from ZODB.POSException import UndoError, POSKeyError, MultipleUndoErrors
from ZODB.TimeStamp import TimeStamp
-from ZODB.lock_file import lock_file
+from ZODB.lock_file import LockFile
from ZODB.utils import p64, u64, cp, z64
try:
@@ -225,18 +225,8 @@
# Lock the database and set up the temp file.
if not read_only:
- try:
- f = open(file_name + '.lock', 'r+')
- except:
- f = open(file_name+'.lock', 'w+')
- lock_file(f)
- try:
- f.write(str(os.getpid()))
- f.flush()
- except:
- pass
- self._lock_file = f # so it stays open
-
+ # Create the lock file
+ self._lock_file = LockFile(file_name + '.lock')
self._tfile = open(file_name + '.tmp', 'w+b')
else:
self._tfile = None