Commit 7a94e312 authored by Kirill Smelkov's avatar Kirill Smelkov

zodbcommit: Fix it for ZODB3 and ZODB4

maxtid is in ZODB.utils starting only from ZODB5.

ZODB{3,4} want txn._extension, while ZODB5 deprecate it in favour of
parent 0e5d2f81
......@@ -20,7 +20,7 @@
from zodbtools.zodbcommit import zodbcommit
from zodbtools.zodbdump import zodbdump, Transaction, ObjectData, ObjectDelete, ObjectCopy
from zodbtools.util import storageFromURL, sha1
from ZODB.utils import p64, u64, z64, maxtid
from ZODB.utils import p64, u64, z64
from ZODB._compat import BytesIO, dumps, _protocol # XXX can't yet commit with arbitrary ext.bytes
from tempfile import mkdtemp
......@@ -53,7 +53,7 @@ def test_zodbcommit(zext):
buf = BytesIO()
zodbdump(stor, p64(u64(head)+1), maxtid, out=buf)
zodbdump(stor, p64(u64(head)+1), None, out=buf)
dumped = buf.getvalue()
assert dumped == ''.join([_.zdump() for _ in (t1, t2)])
......@@ -444,6 +444,11 @@ class Transaction(object):
return {}
return loads(self.extension_bytes)
# ZODB < 5 wants ._extension
def _extension(self):
return self.extension
# zdump returns text representation of a record in zodbdump format.
def zdump(self):
z = 'txn %s %s\n' % (ashex(self.tid), qq(self.status))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment