[Zodb-checkins] SVN: ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/ - added compatibility for win32

Christian Theune ct at gocept.com
Thu Mar 8 16:54:21 EST 2007


Log message for revision 73078:
   - added compatibility for win32
  

Changed:
  U   ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/Blob.py
  U   ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/interfaces.py

-=-
Modified: ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/Blob.py
===================================================================
--- ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/Blob.py	2007-03-08 21:52:25 UTC (rev 73077)
+++ ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/Blob.py	2007-03-08 21:54:21 UTC (rev 73078)
@@ -17,6 +17,7 @@
 __docformat__ = "reStructuredText"
 
 import os
+import sys
 import time
 import tempfile
 import logging
@@ -30,16 +31,21 @@
 import transaction.interfaces
 from persistent import Persistent
 
+if sys.platform == 'win32':
+    import win32file
 
 BLOB_SUFFIX = ".blob"
 
 
 class Blob(Persistent):
- 
+
     zope.interface.implements(IBlob)
 
     # Binding this to an attribute allows overriding it in the unit tests
-    _os_link = os.link
+    if sys.platform == 'win32':
+        _os_link = lambda src, dst: win32file.CreateHardLink(src, dst, None)
+    else:
+        _os_link = os.link
 
     _p_blob_readers = 0
     _p_blob_writers = 0

Modified: ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/interfaces.py
===================================================================
--- ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/interfaces.py	2007-03-08 21:52:25 UTC (rev 73077)
+++ ZODB/branches/ctheune-blobszerocopy/src/ZODB/Blobs/interfaces.py	2007-03-08 21:54:21 UTC (rev 73078)
@@ -45,8 +45,9 @@
         """Will replace the current data of the blob with the file given under
         filename.
 
-        This method uses link() internally and has the same requirements (UNIX
-        only and must live on the same partition as the original file).
+        This method uses link-like semantics internally and has the requirement
+        that the file that is to be consumed lives on the same volume (or
+        mount/share) as the blob directory.
 
         The blob must not be opened for reading or writing when consuming a 
         file.



More information about the Zodb-checkins mailing list