Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
8afbdd53
Commit
8afbdd53
authored
Nov 13, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: detect if monkey-patched code changes
parent
54d692c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
neo/client/__init__.py
neo/client/__init__.py
+17
-3
No files found.
neo/client/__init__.py
View file @
8afbdd53
...
@@ -12,18 +12,25 @@
...
@@ -12,18 +12,25 @@
#
#
##############################################################################
##############################################################################
# At the moment, no ZODB release include the following patches.
# Later, this must be replaced by some detection mechanism.
if
1
:
if
1
:
from
hashlib
import
md5
from
ZODB.Connection
import
Connection
from
ZODB.Connection
import
Connection
def
_check
(
f
,
*
args
):
h
=
md5
(
f
.
func_code
.
co_code
).
hexdigest
()
assert
h
in
args
,
h
# Allow serial to be returned as late as tpc_finish
# Allow serial to be returned as late as tpc_finish
#
#
# This makes possible for storage to allocate serial inside tpc_finish,
# This makes possible for storage to allocate serial inside tpc_finish,
# removing the requirement to serialise second commit phase (tpc_vote
# removing the requirement to serialise second commit phase (tpc_vote
# to tpc_finish/tpc_abort).
# to tpc_finish/tpc_abort).
_check
(
Connection
.
tpc_finish
,
'f50ed2e5a74f584fa1ecaf1cd70a6b15'
,
# Python 2.6
'ab9b1b8d82c40e5fffa84f7bc4ea3a8b'
,
# Python 2.7
)
def
tpc_finish
(
self
,
transaction
):
def
tpc_finish
(
self
,
transaction
):
"""Indicate confirmation that the transaction is done."""
"""Indicate confirmation that the transaction is done."""
...
@@ -39,6 +46,7 @@ if 1:
...
@@ -39,6 +46,7 @@ if 1:
# to be able to read any updated data until we've had a chance
# to be able to read any updated data until we've had a chance
# to send an invalidation message to all of the other
# to send an invalidation message to all of the other
# connections!
# connections!
# <patch>
serial
=
self
.
_storage
.
tpc_finish
(
transaction
,
callback
)
serial
=
self
.
_storage
.
tpc_finish
(
transaction
,
callback
)
if
serial
is
not
None
:
if
serial
is
not
None
:
assert
isinstance
(
serial
,
str
),
repr
(
serial
)
assert
isinstance
(
serial
,
str
),
repr
(
serial
)
...
@@ -49,6 +57,7 @@ if 1:
...
@@ -49,6 +57,7 @@ if 1:
if
obj
is
not
None
and
obj
.
_p_changed
is
not
None
:
if
obj
is
not
None
and
obj
.
_p_changed
is
not
None
:
obj
.
_p_changed
=
0
obj
.
_p_changed
=
0
obj
.
_p_serial
=
serial
obj
.
_p_serial
=
serial
# </patch>
self
.
_tpc_cleanup
()
self
.
_tpc_cleanup
()
Connection
.
tpc_finish
=
tpc_finish
Connection
.
tpc_finish
=
tpc_finish
...
@@ -62,6 +71,11 @@ if 1:
...
@@ -62,6 +71,11 @@ if 1:
# so this should not be done in afterCompletion(), and anyway, we don't
# so this should not be done in afterCompletion(), and anyway, we don't
# know any legitimate use of DB access outside a transaction.
# know any legitimate use of DB access outside a transaction.
_check
(
Connection
.
afterCompletion
,
'70dfc3df8a455d9f663dec619c607eb5'
,
# Python 2.6
'cd3a080b80fd957190ff3bb867149448'
,
# Python 2.7
)
def
afterCompletion
(
self
,
*
ignored
):
def
afterCompletion
(
self
,
*
ignored
):
self
.
_readCurrent
.
clear
()
self
.
_readCurrent
.
clear
()
# PATCH: do not call sync()
# PATCH: do not call sync()
...
...
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