Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
25c3184d
Commit
25c3184d
authored
Apr 03, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
599409a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
+24
-16
lib/zodb.py
lib/zodb.py
+24
-16
No files found.
lib/zodb.py
View file @
25c3184d
...
...
@@ -264,6 +264,8 @@ ZODB.Connection.Connection.open = Connection_open
# patch for ZODB.Connection to support callback on after database view is changed
ZODB
.
Connection
.
Connection
.
_onResyncCallbacks
=
None
def
Connection_onResyncCallback
(
self
,
f
):
if
zmajor
<=
4
:
raise
AssertionError
(
"onResyncCallback: TODO: add support for ZODB34"
)
if
self
.
_onResyncCallbacks
is
None
:
# NOTE WeakSet does not work for bound methods - they are always created
# anew for each obj.method access, and thus will go away almost immediately
...
...
@@ -273,14 +275,10 @@ def Connection_onResyncCallback(self, f):
assert
not
hasattr
(
ZODB
.
Connection
.
Connection
,
'onResyncCallback'
)
ZODB
.
Connection
.
Connection
.
onResyncCallback
=
Connection_onResyncCallback
# ZODB5: hook into Connection.newTransaction XXX .newTransaction .afterCompletion ?
# ZODB4: hook into Connection._storage_sync XXX .newTransaction .afterCompletion ?
# ZODB3: TODO
# XXX ZODB5 only for now
# XXX ERP5Type/patches/ZODBConnection.py overrides newTransaction without calling orig_newTransaction
# -> fix it there.
_orig_Connection_newTransaction
=
ZODB
.
Connection
.
Connection
.
newTransaction
def
_ZConnection_newTransaction
(
self
,
transaction
,
sync
=
True
):
# ZODB5: hook into Connection.newTransaction
if
zmajor
>=
5
:
_orig_Connection_newTransaction
=
ZODB
.
Connection
.
Connection
.
newTransaction
def
_ZConnection_newTransaction
(
self
,
transaction
,
sync
=
True
):
_orig_Connection_newTransaction
(
self
,
transaction
,
sync
)
# FIXME method name hardcoded. Better not do it and allow f to be general
...
...
@@ -290,4 +288,14 @@ def _ZConnection_newTransaction(self, transaction, sync=True):
for
f
in
self
.
_onResyncCallbacks
:
f
.
on_connection_resync
()
ZODB
.
Connection
.
Connection
.
newTransaction
=
_ZConnection_newTransaction
ZODB
.
Connection
.
Connection
.
newTransaction
=
_ZConnection_newTransaction
# ZODB4: hook into Connection._storage_sync
elif
zmajor
==
4
:
pass
# raises in onResyncCallback
# ZODB3: TODO
else
:
pass
# raises in onResyncCallback
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment