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
c4b5a3b1
Commit
c4b5a3b1
authored
Jul 30, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn rather than fail if DB.open is called with an empty version string.
parent
d08f2f7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
src/CHANGES.txt
src/CHANGES.txt
+7
-0
src/ZODB/DB.py
src/ZODB/DB.py
+10
-2
src/ZODB/tests/testDB.py
src/ZODB/tests/testDB.py
+17
-0
No files found.
src/CHANGES.txt
View file @
c4b5a3b1
...
@@ -30,6 +30,13 @@ Bugs Fixed
...
@@ -30,6 +30,13 @@ Bugs Fixed
- BlobStorage was not compatible with MVCC storages because the
- BlobStorage was not compatible with MVCC storages because the
wrappers were being removed by each database connection. Fixed.
wrappers were being removed by each database connection. Fixed.
Features added back
-------------------
- Warn rather than fail if DB.open is called with an empty version
string.
3.9.0b2 (2009-06-11)
3.9.0b2 (2009-06-11)
====================
====================
...
...
src/ZODB/DB.py
View file @
c4b5a3b1
...
@@ -14,8 +14,6 @@
...
@@ -14,8 +14,6 @@
"""Database objects
"""Database objects
"""
"""
import
warnings
import
cPickle
import
cPickle
import
cStringIO
import
cStringIO
import
sys
import
sys
...
@@ -24,6 +22,7 @@ import logging
...
@@ -24,6 +22,7 @@ import logging
import
datetime
import
datetime
import
calendar
import
calendar
import
time
import
time
import
warnings
from
ZODB.broken
import
find_global
from
ZODB.broken
import
find_global
from
ZODB.utils
import
z64
from
ZODB.utils
import
z64
...
@@ -728,6 +727,15 @@ class DB(object):
...
@@ -728,6 +727,15 @@ class DB(object):
raise
ValueError
(
raise
ValueError
(
'cannot open an historical connection in the future.'
)
'cannot open an historical connection in the future.'
)
if
isinstance
(
transaction_manager
,
basestring
):
if
transaction_manager
:
raise
TypeError
(
"Versions aren't supported."
)
warnings
.
warn
(
"A version string was passed to open.
\
n
"
"The first argument is a transaction manager."
,
DeprecationWarning
,
2
)
transaction_manager
=
None
self
.
_a
()
self
.
_a
()
try
:
try
:
# result <- a connection
# result <- a connection
...
...
src/ZODB/tests/testDB.py
View file @
c4b5a3b1
...
@@ -240,6 +240,23 @@ if sys.version_info >= (2, 6):
...
@@ -240,6 +240,23 @@ if sys.version_info >= (2, 6):
>>> db.close()
>>> db.close()
"""
"""
def
connection_allows_empty_version_for_idiots
():
r"""
>>> import sys, StringIO
>>> stderr = sys.stderr
>>> sys.stderr = StringIO.StringIO()
>>> db = ZODB.DB('t.fs')
>>> c = db.open('')
>>> sys.stderr.getvalue() # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
'...: DeprecationWarning: A version string was passed to
open.\nThe first argument is a transaction manager...
>>> sys.stderr = stderr
>>> c.root()
{}
>>> db.close()
"""
def
test_suite
():
def
test_suite
():
s
=
unittest
.
makeSuite
(
DBTests
)
s
=
unittest
.
makeSuite
(
DBTests
)
s
.
addTest
(
doctest
.
DocTestSuite
(
s
.
addTest
(
doctest
.
DocTestSuite
(
...
...
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