Commit bd50a59f authored by Marius Gedminas's avatar Marius Gedminas

More ResourceWarnings fixes

parent 290b0734
......@@ -962,10 +962,9 @@ class FileStorage(
# We're undoing a blob modification operation.
# We have to copy the blob data
tmp = ZODB.utils.mktemp(dir=self.fshelper.temp_dir)
with open(tmp, 'wb') as fp:
ZODB.utils.cp(
self.openCommittedBlobFile(h.oid, userial),
fp)
with self.openCommittedBlobFile(h.oid, userial) as sfp:
with open(tmp, 'wb') as dfp:
ZODB.utils.cp(sfp, dfp)
self._blob_storeblob(h.oid, self._tid, tmp)
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.
True
>>> storage.loadBefore(oid1, conn.root()._p_serial) == (p1, s1, tid)
True
>>> open(storage.loadBlob(oid1, s1)).read()
>>> with open(storage.loadBlob(oid1, s1)) as fp: fp.read()
'some data'
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