Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Nicolas Wavrant
ZODB
Commits
5647476b
Commit
5647476b
authored
Apr 27, 2007
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only hack tpc_vote if a storage is not read only.
Added deprecation warnings for using versions.
parent
54419e66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
src/ZODB/DB.py
src/ZODB/DB.py
+35
-2
No files found.
src/ZODB/DB.py
View file @
5647476b
...
@@ -250,10 +250,10 @@ class DB(object):
...
@@ -250,10 +250,10 @@ class DB(object):
except
TypeError
:
except
TypeError
:
storage
.
registerDB
(
self
,
None
)
# Backward compat
storage
.
registerDB
(
self
,
None
)
# Backward compat
if
not
hasattr
(
storage
,
'tpc_vote'
):
if
(
not
hasattr
(
storage
,
'tpc_vote'
))
and
not
storage
.
isReadOnly
(
):
warnings
.
warn
(
warnings
.
warn
(
"Storage doesn't have a tpc_vote and this violates "
"Storage doesn't have a tpc_vote and this violates "
"the st
i
rage API. Violently monkeypatching in a do-nothing "
"the st
o
rage API. Violently monkeypatching in a do-nothing "
"tpc_vote."
,
"tpc_vote."
,
DeprecationWarning
,
2
)
DeprecationWarning
,
2
)
storage
.
tpc_vote
=
lambda
*
args
:
None
storage
.
tpc_vote
=
lambda
*
args
:
None
...
@@ -370,6 +370,10 @@ class DB(object):
...
@@ -370,6 +370,10 @@ class DB(object):
self
.
_r
()
self
.
_r
()
def
abortVersion
(
self
,
version
,
txn
=
None
):
def
abortVersion
(
self
,
version
,
txn
=
None
):
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
if
txn
is
None
:
if
txn
is
None
:
txn
=
transaction
.
get
()
txn
=
transaction
.
get
()
txn
.
register
(
AbortVersion
(
self
,
version
))
txn
.
register
(
AbortVersion
(
self
,
version
))
...
@@ -487,6 +491,10 @@ class DB(object):
...
@@ -487,6 +491,10 @@ class DB(object):
self
.
_storage
.
close
()
self
.
_storage
.
close
()
def
commitVersion
(
self
,
source
,
destination
=
''
,
txn
=
None
):
def
commitVersion
(
self
,
source
,
destination
=
''
,
txn
=
None
):
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
if
txn
is
None
:
if
txn
is
None
:
txn
=
transaction
.
get
()
txn
=
transaction
.
get
()
txn
.
register
(
CommitVersion
(
self
,
source
,
destination
))
txn
.
register
(
CommitVersion
(
self
,
source
,
destination
))
...
@@ -507,9 +515,17 @@ class DB(object):
...
@@ -507,9 +515,17 @@ class DB(object):
return
self
.
_storage
.
getSize
()
return
self
.
_storage
.
getSize
()
def
getVersionCacheSize
(
self
):
def
getVersionCacheSize
(
self
):
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
return
self
.
_version_cache_size
return
self
.
_version_cache_size
def
getVersionPoolSize
(
self
):
def
getVersionPoolSize
(
self
):
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
return
self
.
_version_pool_size
return
self
.
_version_pool_size
def
invalidate
(
self
,
tid
,
oids
,
connection
=
None
,
version
=
''
):
def
invalidate
(
self
,
tid
,
oids
,
connection
=
None
,
version
=
''
):
...
@@ -559,6 +575,15 @@ class DB(object):
...
@@ -559,6 +575,15 @@ class DB(object):
register for afterCompletion() calls.
register for afterCompletion() calls.
"""
"""
if
version
:
if
not
self
.
supportsVersions
():
raise
ValueError
(
"Versions are not supported by this database."
)
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
self
.
_a
()
self
.
_a
()
try
:
try
:
# pool <- the _ConnectionPool for this version
# pool <- the _ConnectionPool for this version
...
@@ -672,6 +697,10 @@ class DB(object):
...
@@ -672,6 +697,10 @@ class DB(object):
self
.
_r
()
self
.
_r
()
def
setVersionCacheSize
(
self
,
size
):
def
setVersionCacheSize
(
self
,
size
):
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
self
.
_a
()
self
.
_a
()
try
:
try
:
self
.
_version_cache_size
=
size
self
.
_version_cache_size
=
size
...
@@ -688,6 +717,10 @@ class DB(object):
...
@@ -688,6 +717,10 @@ class DB(object):
self
.
_reset_pool_sizes
(
size
,
for_versions
=
False
)
self
.
_reset_pool_sizes
(
size
,
for_versions
=
False
)
def
setVersionPoolSize
(
self
,
size
):
def
setVersionPoolSize
(
self
,
size
):
warnings
.
warn
(
"Versions are deprecated and will become unsupported "
"in ZODB 3.9"
,
DeprecationWarning
,
2
)
self
.
_version_pool_size
=
size
self
.
_version_pool_size
=
size
self
.
_reset_pool_sizes
(
size
,
for_versions
=
True
)
self
.
_reset_pool_sizes
(
size
,
for_versions
=
True
)
...
...
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