Commit bd50a59f authored by Marius Gedminas's avatar Marius Gedminas

More ResourceWarnings fixes

parent 290b0734
...@@ -962,10 +962,9 @@ class FileStorage( ...@@ -962,10 +962,9 @@ class FileStorage(
# We're undoing a blob modification operation. # We're undoing a blob modification operation.
# We have to copy the blob data # We have to copy the blob data
tmp = ZODB.utils.mktemp(dir=self.fshelper.temp_dir) tmp = ZODB.utils.mktemp(dir=self.fshelper.temp_dir)
with open(tmp, 'wb') as fp: with self.openCommittedBlobFile(h.oid, userial) as sfp:
ZODB.utils.cp( with open(tmp, 'wb') as dfp:
self.openCommittedBlobFile(h.oid, userial), ZODB.utils.cp(sfp, dfp)
fp)
self._blob_storeblob(h.oid, self._tid, tmp) self._blob_storeblob(h.oid, self._tid, tmp)
new = DataHeader(h.oid, self._tid, ipos, otloc, 0, len(p)) new = DataHeader(h.oid, self._tid, ipos, otloc, 0, len(p))
......
...@@ -68,7 +68,7 @@ We can still get the data if we load before the time we deleted. ...@@ -68,7 +68,7 @@ We can still get the data if we load before the time we deleted.
True True
>>> storage.loadBefore(oid1, conn.root()._p_serial) == (p1, s1, tid) >>> storage.loadBefore(oid1, conn.root()._p_serial) == (p1, s1, tid)
True True
>>> open(storage.loadBlob(oid1, s1)).read() >>> with open(storage.loadBlob(oid1, s1)) as fp: fp.read()
'some data' 'some data'
If we pack, however, the old data will be removed and the data will be If we pack, however, the old data will be removed and the data will be
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment