Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a63e899c
Commit
a63e899c
authored
Jun 18, 2010
by
Leonardo Rochael Almeida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the result of Shared.DC.ZRDB.TM.TM.sortKey() adjustable
parent
910a640a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
src/Shared/DC/ZRDB/TM.py
src/Shared/DC/ZRDB/TM.py
+11
-6
src/Shared/DC/ZRDB/tests/testTM.py
src/Shared/DC/ZRDB/tests/testTM.py
+29
-0
No files found.
src/Shared/DC/ZRDB/TM.py
View file @
a63e899c
...
@@ -26,7 +26,7 @@ class TM:
...
@@ -26,7 +26,7 @@ class TM:
needed at the start of a transaction.
needed at the start of a transaction.
A subclass that uses locking during transaction commit must
A subclass that uses locking during transaction commit must
define
d
a sortKey() method.
define a sortKey() method.
"""
"""
_registered
=
None
_registered
=
None
...
@@ -66,13 +66,18 @@ class TM:
...
@@ -66,13 +66,18 @@ class TM:
tpc_abort
=
abort
tpc_abort
=
abort
# Most DA's talking to RDBMS systems do not care about commit order, so
# return the constant 1
_sort_key
=
1
def
sortKey
(
self
,
*
ignored
):
def
sortKey
(
self
,
*
ignored
):
""" The sortKey method is used for recent ZODB compatibility which
""" The sortKey method is used by ZODB to have a known commit order for
needs to have a known commit order for lock acquisition. Most
lock acquisition.
DA's talking to RDBMS systems do not care about commit order, so
return the constant 1
"""
"""
return
1
return
self
.
_sort_key
def
setSortKey
(
self
,
sort_key
):
self
.
_sort_key
=
sort_key
class
Surrogate
:
class
Surrogate
:
...
...
src/Shared/DC/ZRDB/tests/testTM.py
0 → 100644
View file @
a63e899c
##############################################################################
#
# Copyright (c) 2009 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from
unittest
import
TestCase
,
TestSuite
,
makeSuite
from
Shared.DC.ZRDB.TM
import
TM
class
TestTM
(
TestCase
):
def
test_sortKey
(
self
):
tm
=
TM
()
# the default Transaction Manager should have .sortKey() of 1 for
# backward compatibility
self
.
assertEquals
(
tm
.
sortKey
(),
1
)
# but the sortKey() should be adjustable
tm
.
setSortKey
(())
self
.
assertEquals
(
tm
.
sortKey
(),
())
def
test_suite
():
return
TestSuite
((
makeSuite
(
TestTM
),))
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