[Zope-Checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.63
Jeremy Hylton
jeremy@zope.com
Tue, 4 Sep 2001 16:27:56 -0400
Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv27084
Modified Files:
FileStorage.py
Log Message:
Use os.remove() in all cases, instead of mixing remove() and unlink().
Add one case where failure to remove is not a fatal error. And be more
specific about the error that is caught -- OSError only.
=== StandaloneZODB/ZODB/FileStorage.py 1.62 => 1.63 ===
if create:
- if os.path.exists(file_name): os.remove(file_name)
+ if os.path.exists(file_name):
+ os.remove(file_name)
file=open(file_name,'w+b')
file.write(packed_version)
else:
@@ -355,15 +356,20 @@
f.flush()
f.close()
try:
- try: os.unlink(index_name)
- except: pass
+ try:
+ os.remove(index_name)
+ except OSError:
+ pass
os.rename(tmp_name, index_name)
except: pass
def _clear_index(self):
index_name=self.__name__+'.index'
if os.path.exists(index_name):
- os.unlink(index_name)
+ try:
+ os.remove(index_name)
+ except OSError:
+ pass
def _sane(self, index, pos):
"""Sanity check saved index data by reading the last undone trans