Commit 5a1df8c0 authored by Kirill Smelkov's avatar Kirill Smelkov

fixup! DemoStorage: Add support for deleteObject (IExternalGC)

Make flake8 happy

src/ZODB/DemoStorage.py:388:80: E501 line too long (89 > 79 characters)
src/ZODB/DemoStorage.py:391:80: E501 line too long (87 > 79 characters)
src/ZODB/DemoStorage.py:393:80: E501 line too long (83 > 79 characters)
src/ZODB/DemoStorage.py:395:80: E501 line too long (87 > 79 characters)
src/ZODB/DemoStorage.py:397:80: E501 line too long (100 > 79 characters)
src/ZODB/DemoStorage.py:398:80: E501 line too long (86 > 79 characters)
src/ZODB/DemoStorage.py:408:5: E303 too many blank lines (2)
src/ZODB/tests/testDemoStorage.py:397:9: F401 'ZODB.FileStorage.FileStorage' imported but unused
src/ZODB/tests/testDemoStorage.py:399:80: E501 line too long (101 > 79 characters)
parent c3820ff4
......@@ -385,17 +385,22 @@ class DemoStorage(ConflictResolvingStorage):
# call changes.deleteObject(oldserial=z64)
changesHead = self.changes.lastTransaction()
_, serial = ZODB.utils.loadBeforeEx(self.changes, oid, p64(u64(changesHead) + 1))
_, serial = ZODB.utils.loadBeforeEx(self.changes, oid,
p64(u64(changesHead) + 1))
if serial != ZODB.utils.z64:
# object has data or deletion record in changes
raise ZODB.POSException.ConflictError(oid=oid, serials=(serial, oldserial))
raise ZODB.POSException.ConflictError(oid=oid,
serials=(serial, oldserial))
_, serial = ZODB.utils.loadBeforeEx(self.base, oid, p64(u64(baseHead) + 1))
_, serial = ZODB.utils.loadBeforeEx(self.base, oid,
p64(u64(baseHead) + 1))
if serial != oldserial:
raise ZODB.POSException.ConflictError(oid=oid, serials=(serial, oldserial))
raise ZODB.POSException.ConflictError(oid=oid,
serials=(serial, oldserial))
# object has no data/deletion record in changes and its latest revision in base == oldserial
# -> changes.deleteObject(oldserial=z64) + correct oldserial back on conflict.
# object has no data/deletion record in changes and its latest revision
# in base == oldserial. -> changes.deleteObject(oldserial=z64) +
# correct oldserial back on conflict.
try:
self.changes.deleteObject(oid, ZODB.utils.z64, transaction)
except ZODB.POSException.ConflictError as e:
......@@ -404,7 +409,6 @@ class DemoStorage(ConflictResolvingStorage):
e.serials = (e.serials[0], oldserial)
raise
def storeBlob(self, oid, oldserial, data, blobfilename, version,
transaction):
assert version == '', "versions aren't supported"
......
......@@ -394,9 +394,10 @@ def test_suite():
suite.addTest(unittest.makeSuite(DemoStorageTests2, 'check'))
def demo_for_gctest():
from ZODB.FileStorage import FileStorage
base = ZODB.FileStorage.FileStorage('data.fs', blob_dir="data_blobs")
changes = ZODB.FileStorage.FileStorage('changes.fs', blob_dir="changes_blobs", pack_gc=False)
changes = ZODB.FileStorage.FileStorage('changes.fs',
blob_dir="changes_blobs",
pack_gc=False)
return ZODB.DemoStorage.DemoStorage(base=base, changes=changes)
suite.addTest(PackableStorage.IExternalGC_suite(demo_for_gctest))
......
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