Commit c4b5a3b1 authored by Jim Fulton's avatar Jim Fulton

Warn rather than fail if DB.open is called with an empty version string.

parent d08f2f7c
......@@ -30,6 +30,13 @@ Bugs Fixed
- 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)
====================
......
......@@ -14,8 +14,6 @@
"""Database objects
"""
import warnings
import cPickle
import cStringIO
import sys
......@@ -24,6 +22,7 @@ import logging
import datetime
import calendar
import time
import warnings
from ZODB.broken import find_global
from ZODB.utils import z64
......@@ -728,6 +727,15 @@ class DB(object):
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
......
......@@ -240,6 +240,23 @@ if sys.version_info >= (2, 6):
>>> 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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment