From: Mike Bayer Date: Mon, 21 Mar 2011 15:49:43 +0000 (-0400) Subject: - Restored the "catchall" constructor on the base X-Git-Tag: rel_0_7b4~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39c465ecf3f45bbebb37c5d5ed7e1a0fccf5641c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - 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. --- diff --git a/CHANGES b/CHANGES index f4d32a6044..91da615d00 100644 --- a/CHANGES +++ b/CHANGES @@ -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 2b4cfde0fc..0cab28da1e 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 100a20c6ee..de74b20319 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 2262831952..adfe2a8a94 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):