Commit 27c1870a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 81f819e3
......@@ -58,8 +58,8 @@ from wendelin.lib.zodb import zconn_at
# _ZBigFile is base class for ZBigFile that provides BigFile-line base.
#
# The other base line is from Persistent. It is not possible to inherit from
# both Persistent and BigFile at the same time since both types are C types and
# their layouts conflict.
# both Persistent and BigFile at the same time since both are C types and their
# layouts conflict.
#
# _ZBigFile:
#
......@@ -141,8 +141,9 @@ cdef wcfs.PyConn pywconnOf(zconn):
# ZSync keeps wconn in sync with zconn.
# XXX -> make generic and usefor _ZBigFileH too?
# XXX naming?
# XXX -> make generic and use for _ZBigFileH too?
# -> y: ZSync base + ZSyncWConn, ZSyncBigFileH
# XXX naming? -> ZKeepInSync ?
class ZSync:
# .zconn
# .wconn
......
......@@ -305,6 +305,46 @@ def test_zconn_at():
assert zconn_at(conn_at0) == at0
# verify that ZODB.Connection.onResyncCallback works
@func
def test_zodb_onresync():
stor = testdb.getZODBStorage()
defer(stor.close)
db = DB(stor)
class T:
def __init__(t):
t.nresync = 0
def on_connection_resync(t):
t.nresync += 1
t = T()
conn = db.open()
conn.onResyncCallback(t)
assert t.nresync == 0
# abort makes conn to enter new transaction
transaction.abort()
assert t.nresync == 1
# close/reopen -> new transaction
conn.close()
assert t.nresync == 1
conn_ = db.open()
assert conn_ is conn
assert t.nresync == 2
# commit -> new transaction
root = conn.root()
root['r'] = 1
assert t.nresync == 2
transaction.commit()
assert t.nresync == 3
conn.close()
# ---- misc ----
# zsync syncs ZODB storage.
......
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