diff options
-rw-r--r-- | CHANGES | 8 | ||||
-rw-r--r-- | lib/sqlalchemy/__init__.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/types.py | 9 | ||||
-rw-r--r-- | test/sql/test_types.py | 8 |
4 files changed, 22 insertions, 5 deletions
@@ -3,6 +3,14 @@ ======= CHANGES ======= +0.7.0b4 +======= +- sql + - Restored the "catchall" constructor on the base + TypeEngine class, with a deprecation warning. + This so that code which does something like + Integer(11) still succeeds. + 0.7.0b3 ======= - general diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 2b4cfde0f..0cab28da1 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -116,6 +116,6 @@ from sqlalchemy.engine import create_engine, engine_from_config __all__ = sorted(name for name, obj in locals().items() if not (name.startswith('_') or inspect.ismodule(obj))) -__version__ = '0.7b3' +__version__ = '0.7b4' del inspect, sys diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 100a20c6e..de74b2031 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -241,10 +241,11 @@ class TypeEngine(AbstractType): encode('ascii', 'backslashreplace') # end Py2K - def __init__(self): - # supports getargspec of the __init__ method - # used by generic __repr__ - pass + def __init__(self, *args, **kwargs): + """Support implementations that were passing arguments""" + if args or kwargs: + util.warn_deprecated("Passing arguments to type object " + "constructor %s is deprecated" % self.__class__) def __repr__(self): return "%s(%s)" % ( diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 226283195..adfe2a8a9 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -121,6 +121,14 @@ class AdaptTest(TestBase): continue eq_(getattr(t2, k), t1.__dict__[k]) + def test_plain_init_deprecation_warning(self): + for typ in (Integer, Date, SmallInteger): + assert_raises_message( + exc.SADeprecationWarning, + "Passing arguments to type object " + "constructor %s is deprecated" % typ, + typ, 11 + ) class TypeAffinityTest(TestBase): def test_type_affinity(self): |