[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ Open blob files in binary mode!

Jim Fulton jim at zope.com
Mon Oct 20 16:39:40 EDT 2008


Log message for revision 92410:
  Open blob files in binary mode!

Changed:
  U   ZODB/trunk/src/ZODB/blob.py
  U   ZODB/trunk/src/ZODB/tests/IteratorStorage.py

-=-
Modified: ZODB/trunk/src/ZODB/blob.py
===================================================================
--- ZODB/trunk/src/ZODB/blob.py	2008-10-20 17:01:00 UTC (rev 92409)
+++ ZODB/trunk/src/ZODB/blob.py	2008-10-20 20:39:38 UTC (rev 92410)
@@ -510,7 +510,7 @@
                     fd, name = tempfile.mkstemp(
                         suffix='.tmp', dir=self.fshelper.temp_dir)
                     os.close(fd)
-                    utils.cp(open(blobfilename), open(name, 'wb'))
+                    utils.cp(open(blobfilename, 'rb'), open(name, 'wb'))
                     self.restoreBlob(record.oid, record.tid, record.data,
                                      name, record.data_txn, trans)
                 else:

Modified: ZODB/trunk/src/ZODB/tests/IteratorStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/IteratorStorage.py	2008-10-20 17:01:00 UTC (rev 92409)
+++ ZODB/trunk/src/ZODB/tests/IteratorStorage.py	2008-10-20 20:39:38 UTC (rev 92410)
@@ -224,7 +224,7 @@
                     else:
                         fn2 = storage2.loadBlob(rec1.oid, rec1.tid)
                         self.assert_(fn1 != fn2)
-                        eq(open(fn1).read(), open(fn2).read())
+                        eq(open(fn1, 'rb').read(), open(fn2, 'rb').read())
                 
             # Make sure there are no more records left in rec1 and rec2,
             # meaning they were the same length.



More information about the Zodb-checkins mailing list