Properly report open mode to transaction stores.

The mode was always being reported as "w" (write), which resulted in SHA-256
checksums not being validated on load.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This commit is contained in:
brian m. carlson 2014-01-08 03:34:54 +00:00
parent 3d39ca84e6
commit 450bf7ff6a
No known key found for this signature in database
GPG key ID: BF535D811F52F68B
2 changed files with 2 additions and 3 deletions

View file

@ -210,12 +210,12 @@ class FileFormat:
self._txnstore = txn
self._options = options or {}
def _open(self, mode):
self._txnstore.prepare_open(self._filename, "w")
self._txnstore.prepare_open(self._filename, mode)
if self._isfp:
fp = self._file
else:
fp = open(self._filename, mode)
self._txnstore.commit_open(self._filename, "w")
self._txnstore.commit_open(self._filename, mode)
return fp
def _close(self, fp):
self._txnstore.prepare_close()

View file

@ -85,7 +85,6 @@ class SHA256TransactionTest(unittest.TestCase):
x.tempfile = self.create_small_database(x.tempdir)
x.fs = FileStorage("csv", x.tempfile, "sha256", *args)
return x
@unittest.expectedFailure
def test_missing_not_forgiving(self):
x = self.create_filestorage({"forgiving": False})
with self.assertRaisesRegex(newfol.exception.UpgradeNeededError,