[Zodb-checkins] SVN: ZODB/trunk/src/ Warn rather than fail if DB.open is called with an empty version string.
Jim Fulton
jim at zope.com
Thu Jul 30 14:30:52 EDT 2009
Log message for revision 102381:
Warn rather than fail if DB.open is called with an empty version string.
Changed:
U ZODB/trunk/src/CHANGES.txt
U ZODB/trunk/src/ZODB/DB.py
U ZODB/trunk/src/ZODB/tests/testDB.py
-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2009-07-30 18:19:19 UTC (rev 102380)
+++ ZODB/trunk/src/CHANGES.txt 2009-07-30 18:30:52 UTC (rev 102381)
@@ -30,6 +30,13 @@
- BlobStorage was not compatible with MVCC storages because the
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)
====================
Modified: ZODB/trunk/src/ZODB/DB.py
===================================================================
--- ZODB/trunk/src/ZODB/DB.py 2009-07-30 18:19:19 UTC (rev 102380)
+++ ZODB/trunk/src/ZODB/DB.py 2009-07-30 18:30:52 UTC (rev 102381)
@@ -14,8 +14,6 @@
"""Database objects
"""
-import warnings
-
import cPickle
import cStringIO
import sys
@@ -24,6 +22,7 @@
import datetime
import calendar
import time
+import warnings
from ZODB.broken import find_global
from ZODB.utils import z64
@@ -728,6 +727,15 @@
raise ValueError(
'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()
try:
# result <- a connection
Modified: ZODB/trunk/src/ZODB/tests/testDB.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testDB.py 2009-07-30 18:19:19 UTC (rev 102380)
+++ ZODB/trunk/src/ZODB/tests/testDB.py 2009-07-30 18:30:52 UTC (rev 102381)
@@ -240,6 +240,23 @@
>>> 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():
s = unittest.makeSuite(DBTests)
s.addTest(doctest.DocTestSuite(
More information about the Zodb-checkins
mailing list