[Zodb-checkins] SVN: ZODB/branches/blob-merge-branch/src/ZODB/ -
removed best_rename, using os.rename again
Christian Theune
ct at gocept.com
Sun Feb 26 22:45:16 EST 2006
Log message for revision 65505:
- removed best_rename, using os.rename again
Changed:
U ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py
U ZODB/branches/blob-merge-branch/src/ZODB/Connection.py
U ZODB/branches/blob-merge-branch/src/ZODB/utils.py
-=-
Modified: ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py 2006-02-27 03:44:37 UTC (rev 65504)
+++ ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py 2006-02-27 03:45:16 UTC (rev 65505)
@@ -63,7 +63,7 @@
os.makedirs(targetpath, 0700)
targetname = self._getCleanFilename(oid, serial)
- utils.best_rename(blobfilename, targetname)
+ os.rename(blobfilename, targetname)
# XXX if oid already in there, something is really hosed.
# The underlying storage should have complained anyway
Modified: ZODB/branches/blob-merge-branch/src/ZODB/Connection.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/Connection.py 2006-02-27 03:44:37 UTC (rev 65504)
+++ ZODB/branches/blob-merge-branch/src/ZODB/Connection.py 2006-02-27 03:45:16 UTC (rev 65505)
@@ -1205,7 +1205,7 @@
os.makedirs(targetpath, 0700)
targetname = self._getCleanFilename(oid, serial)
- utils.best_rename(blobfilename, targetname)
+ os.rename(blobfilename, targetname)
def loadBlob(self, oid, serial, version):
"""Return the filename where the blob file can be found.
Modified: ZODB/branches/blob-merge-branch/src/ZODB/utils.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/utils.py 2006-02-27 03:44:37 UTC (rev 65504)
+++ ZODB/branches/blob-merge-branch/src/ZODB/utils.py 2006-02-27 03:45:16 UTC (rev 65505)
@@ -295,27 +295,4 @@
os.close(handle)
return filename
-def best_rename(sourcename, targetname):
- """ Try to rename via os.rename, but if we can't (for instance, if the
- source and target are on separate partitions/volumes), fall back to copying
- the file and unlinking the original. """
- try:
- os.rename(sourcename, targetname)
- except OSError:
- # XXX CM: I don't think this is a good idea; maybe just fail
- # here instead of doing a brute force copy? This is awfully
- # expensive and people won't know it's happening without
- # at least a warning. It also increases the possibility of a race
- # condition: both the source and target filenames exist at the
- # same time.
- source = open(sourcename, "rb")
- target = open(targetname, "wb")
- while True:
- chunk = source.read(1<<16)
- if not chunk:
- break
- target.write(chunk)
- source.close()
- target.close()
- os.unlink(sourcename)
More information about the Zodb-checkins
mailing list