[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/utils.py Removed rename_or_copy, which was used soley by blobs.

Jim Fulton jim at zope.com
Sun Jun 10 14:25:15 EDT 2007


Log message for revision 76587:
  Removed rename_or_copy, which was used soley by blobs.
  

Changed:
  U   ZODB/trunk/src/ZODB/utils.py

-=-
Modified: ZODB/trunk/src/ZODB/utils.py
===================================================================
--- ZODB/trunk/src/ZODB/utils.py	2007-06-10 18:25:12 UTC (rev 76586)
+++ ZODB/trunk/src/ZODB/utils.py	2007-06-10 18:25:14 UTC (rev 76587)
@@ -12,7 +12,6 @@
 #
 ##############################################################################
 
-import exceptions
 import sys
 import time
 import struct
@@ -114,22 +113,6 @@
         write(data)
         length -= len(data)
 
-
-def rename_or_copy(f1, f2):
-    """Try to rename f1 to f2, fallback to copy.
-
-    Under certain conditions a rename might not work, e.g. because the target
-    directory is on a different partition. In this case we try to copy the
-    data and remove the old file afterwards.
-
-    """
-    try:
-        os.rename(f1, f2)
-    except exceptions.OSError:
-        cp(open(f1, 'rb'), open(f2, 'wb'))
-        os.unlink(f1)
-
-
 def newTimeStamp(old=None,
                  TimeStamp=TimeStamp,
                  time=time.time, gmtime=time.gmtime):



More information about the Zodb-checkins mailing list