Commit 9a348a89 authored by Jim Fulton's avatar Jim Fulton

Fixed to work with transaction 2.0.3.

parent 977e24bf
......@@ -5,6 +5,8 @@
4.4.4 (unreleased)
==================
- Fixed to work with transaction 2.0.3.
- Call _p_resolveConflict() even if a conflicting change doesn't change the
state. This reverts to the behaviour of 3.10.3 and older.
......
......@@ -452,7 +452,7 @@ class DB(object):
p.dump((root.__class__, None))
p.dump(root.__getstate__())
t = transaction.Transaction()
t.description = 'initial database creation'
t.description = u'initial database creation'
temp_storage.tpc_begin(t)
temp_storage.store(z64, None, file.getvalue(), '', t)
temp_storage.tpc_vote(t)
......
......@@ -184,7 +184,7 @@ class BasicStorage:
oid = self._storage.new_oid()
t = transaction.Transaction()
self._storage.tpc_begin(t)
t.note('this is a test')
t.note(u'this is a test')
self._storage.store(oid, ZERO, zodb_pickle(MinPO(5)), '', t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
......
......@@ -148,7 +148,7 @@ class PackableStorageBase:
p.dump((PersistentMapping, None))
p.dump({'_container': {}})
t=Transaction()
t.description='initial database creation'
t.description = u'initial database creation'
self._storage.tpc_begin(t)
self._storage.store(ZERO, None, file.getvalue(), '', t)
self._storage.tpc_vote(t)
......@@ -566,7 +566,7 @@ class PackableUndoStorage(PackableStorageBase):
root = conn.root()
txn = transaction.get()
txn.note('root')
txn.note(u'root')
txn.commit()
now = packtime = time.time()
......@@ -578,12 +578,12 @@ class PackableUndoStorage(PackableStorageBase):
root['obj'] = obj
txn = transaction.get()
txn.note('root -> o1')
txn.note(u'root -> o1')
txn.commit()
del root['obj']
txn = transaction.get()
txn.note('root -x-> o1')
txn.note(u'root -x-> o1')
txn.commit()
self._storage.pack(packtime, referencesf)
......@@ -592,7 +592,7 @@ class PackableUndoStorage(PackableStorageBase):
tid = log[0]['id']
db.undo(tid)
txn = transaction.get()
txn.note('undo root -x-> o1')
txn.note(u'undo root -x-> o1')
txn.commit()
conn.sync()
......
......@@ -71,15 +71,15 @@ class RecoveryStorage(IteratorDeepCompare):
root = conn.root()
root.obj = obj1 = MinPO(1)
txn = transaction.get()
txn.note('root -> obj')
txn.note(u'root -> obj')
txn.commit()
root.obj.obj = obj2 = MinPO(2)
txn = transaction.get()
txn.note('root -> obj -> obj')
txn.note(u'root -> obj -> obj')
txn.commit()
del root.obj
txn = transaction.get()
txn.note('root -X->')
txn.note(u'root -X->')
txn.commit()
# Now copy the transactions to the destination
self._dst.copyTransactionsFrom(self._storage)
......
......@@ -122,7 +122,7 @@ class RevisionStorage:
tid = info[0]["id"]
# Always undo the most recent txn, so the value will
# alternate between 3 and 4.
self._undo(tid, note="undo %d" % i)
self._undo(tid, note=u"undo %d" % i)
revs.append(self._storage.load(oid, ""))
prev_tid = None
......
......@@ -217,7 +217,7 @@ class StorageTestBase(ZODB.tests.util.TestCase):
# Undo a tid that affects a single object (oid).
# This is very specialized.
t = transaction.Transaction()
t.note(note or "undo")
t.note(note or u"undo")
self._storage.tpc_begin(t)
undo_result = self._storage.undo(tid, t)
vote_result = self._storage.tpc_vote(t)
......
......@@ -135,19 +135,19 @@ class TransactionalUndoStorage:
info = self._storage.undoInfo()
# Now start an undo transaction
self._undo(info[0]["id"], [oid], note="undo1")
self._undo(info[0]["id"], [oid], note=u"undo1")
data, revid = self._storage.load(oid, '')
eq(zodb_unpickle(data), MinPO(24))
# Do another one
info = self._storage.undoInfo()
self._undo(info[2]["id"], [oid], note="undo2")
self._undo(info[2]["id"], [oid], note=u"undo2")
data, revid = self._storage.load(oid, '')
eq(zodb_unpickle(data), MinPO(23))
# Try to undo the first record
info = self._storage.undoInfo()
self._undo(info[4]["id"], [oid], note="undo3")
self._undo(info[4]["id"], [oid], note=u"undo3")
# This should fail since we've undone the object's creation
self.assertRaises(KeyError,
self._storage.load, oid, '')
......@@ -167,7 +167,7 @@ class TransactionalUndoStorage:
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
t.note('undo1')
t.note(u'undo1')
self._begin_undos_vote(t, tid)
self._storage.tpc_finish(t)
# Check that calling getTid on an uncreated object raises a KeyError
......@@ -490,7 +490,7 @@ class TransactionalUndoStorage:
root['obj'] = o1
o1.obj = o2
txn = transaction.get()
txn.note('o1 -> o2')
txn.note(u'o1 -> o2')
txn.commit()
now = packtime = time.time()
while packtime <= now:
......@@ -499,12 +499,12 @@ class TransactionalUndoStorage:
o3 = C()
o2.obj = o3
txn = transaction.get()
txn.note('o1 -> o2 -> o3')
txn.note(u'o1 -> o2 -> o3')
txn.commit()
o1.obj = o3
txn = transaction.get()
txn.note('o1 -> o3')
txn.note(u'o1 -> o3')
txn.commit()
log = self._storage.undoLog()
......@@ -522,7 +522,7 @@ class TransactionalUndoStorage:
tid = log[0]['id']
db.undo(tid)
txn = transaction.get()
txn.note('undo')
txn.note(u'undo')
txn.commit()
# undo does a txn-undo, but doesn't invalidate
conn.sync()
......@@ -549,14 +549,14 @@ class TransactionalUndoStorage:
root["key1"] = MinPO(1)
root["key2"] = MinPO(2)
txn = transaction.get()
txn.note("create 3 keys")
txn.note(u"create 3 keys")
txn.commit()
set_pack_time()
del root["key1"]
txn = transaction.get()
txn.note("delete 1 key")
txn.note(u"delete 1 key")
txn.commit()
set_pack_time()
......@@ -568,7 +568,7 @@ class TransactionalUndoStorage:
L = db.undoInfo()
db.undo(L[0]["id"])
txn = transaction.get()
txn.note("undo deletion")
txn.note(u"undo deletion")
txn.commit()
set_pack_time()
......@@ -600,7 +600,7 @@ class TransactionalUndoStorage:
transaction.commit()
rt["test"] = MinPO(3)
txn = transaction.get()
txn.note("root of undo")
txn.note(u"root of undo")
txn.commit()
packtimes = []
......@@ -608,7 +608,7 @@ class TransactionalUndoStorage:
L = db.undoInfo()
db.undo(L[0]["id"])
txn = transaction.get()
txn.note("undo %d" % i)
txn.note(u"undo %d" % i)
txn.commit()
rt._p_deactivate()
cn.sync()
......@@ -665,7 +665,7 @@ class TransactionalUndoStorage:
i = 0
for tid, oid, revid in orig:
self._dostore(oid, revid=revid, data=MinPO(revid),
description="update %s" % i)
description=u"update %s" % i)
# Undo the OBJECTS transactions that modified objects created
# in the ith original transaction.
......@@ -725,9 +725,9 @@ class TransactionalUndoStorage:
def checkUndoLogMetadata(self):
# test that the metadata is correct in the undo log
t = transaction.get()
t.note('t1')
t.note(u't1')
t.setExtendedInfo('k2', 'this is transaction metadata')
t.setUser('u3',path='p3')
t.setUser(u'u3',path=u'p3')
db = DB(self._storage)
conn = db.open()
root = conn.root()
......@@ -811,7 +811,7 @@ class TransactionalUndoStorage:
for i in range(4):
with db.transaction() as conn:
conn.transaction_manager.get().note(str(i))
conn.transaction_manager.get().note(u"%s" % i)
conn.root.x.inc()
ids = [l['id'] for l in db.undoLog(1, 3)]
......
......@@ -30,19 +30,19 @@ def create_dangling_ref(db):
rt = db.open().root()
rt[1] = o1 = P()
transaction.get().note("create o1")
transaction.get().note(u"create o1")
transaction.commit()
rt[2] = o2 = P()
transaction.get().note("create o2")
transaction.get().note(u"create o2")
transaction.commit()
c = o1.child = P()
transaction.get().note("set child on o1")
transaction.get().note(u"set child on o1")
transaction.commit()
o1.child = P()
transaction.get().note("replace child on o1")
transaction.get().note(u"replace child on o1")
transaction.commit()
time.sleep(2)
......@@ -53,7 +53,7 @@ def create_dangling_ref(db):
print(repr(c._p_oid))
o2.child = c
transaction.get().note("set child on o2")
transaction.get().note(u"set child on o2")
transaction.commit()
def main():
......
......@@ -484,7 +484,7 @@ def doctest_transaction_retry_convenience():
>>> import ZODB.POSException
>>> for attempt in transaction.manager.attempts():
... with attempt as t:
... t.note('test')
... t.note(u'test')
... six.print_(dm['ntry'], ntry)
... ntry += 1
... dm['ntry'] = ntry
......
......@@ -65,7 +65,7 @@ class FileStorageTests(
self.open(create=1)
def checkLongMetadata(self):
s = "X" * 75000
s = u"X" * 75000
try:
self._dostore(user=s)
except POSException.StorageError:
......
......@@ -83,7 +83,7 @@ class MVCCTests:
storage = c1._storage
t = transaction.Transaction()
t.description = 'isolation test 1'
t.description = u'isolation test 1'
storage.tpc_begin(t)
c1.commit(t)
storage.tpc_vote(t)
......@@ -109,7 +109,7 @@ class MVCCTests:
storage = c1._storage
t = transaction.Transaction()
t.description = 'isolation test 2'
t.description = u'isolation test 2'
storage.tpc_begin(t)
c1.commit(t)
storage.tpc_vote(t)
......
......@@ -48,7 +48,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
root['test'] = pm = PersistentMapping()
for n in range(100):
pm[n] = PersistentMapping({0: 100 - n})
transaction.get().note('created test data')
transaction.get().note(u'created test data')
transaction.commit()
conn.close()
......@@ -67,7 +67,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
def duplicate(self, conn, abort_it):
transaction.begin()
transaction.get().note('duplication')
transaction.get().note(u'duplication')
root = conn.root()
ob = root['test']
assert len(ob) > 10, 'Insufficient test data'
......@@ -424,7 +424,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
for state_num in range(6):
transaction.begin()
root['state'] = state_num
transaction.get().note('root["state"] = %d' % state_num)
transaction.get().note(u'root["state"] = %d' % state_num)
transaction.commit()
# Undo all but the first. Note that no work is actually
......@@ -433,7 +433,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
log = self._db.undoLog()
self._db.undoMultiple([log[i]['id'] for i in range(5)])
transaction.get().note('undo states 1 through 5')
transaction.get().note(u'undo states 1 through 5')
# Now attempt all those undo operations.
transaction.commit()
......
......@@ -49,7 +49,7 @@ Let's add a BTree:
>>> root = db.open().root()
>>> root['tree'] = OOBTree()
>>> txn.get().note('added an OOBTree')
>>> txn.get().note(u'added an OOBTree')
>>> txn.get().commit()
>>> fsdump(path) #doctest: +ELLIPSIS
Trans #00000 tid=... time=... offset=<OFFSET>
......
......@@ -76,7 +76,7 @@ Let's add a BTree and try again:
>>> root = db.open().root()
>>> root['tree'] = OOBTree()
>>> txn.get().note('added an OOBTree')
>>> txn.get().note(u'added an OOBTree')
>>> txn.get().commit()
>>> t = Tracer(path)
>>> t.register_oids(0, 1)
......@@ -104,7 +104,7 @@ One more, storing a reference in the BTree back to the root object:
>>> tree = root['tree']
>>> tree['root'] = root
>>> txn.get().note('circling back to the root')
>>> txn.get().note(u'circling back to the root')
>>> txn.get().commit()
>>> t = Tracer(path)
>>> t.register_oids(0, 1, 2)
......
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