]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Restored the "catchall" constructor on the base
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Mar 2011 15:49:43 +0000 (11:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 21 Mar 2011 15:49:43 +0000 (11:49 -0400)
TypeEngine class, with a deprecation warning.
This so that code which does something like
Integer(11) still succeeds.

CHANGES
lib/sqlalchemy/__init__.py
lib/sqlalchemy/types.py
test/sql/test_types.py

diff --git a/CHANGES b/CHANGES
index f4d32a604426bb72039e5da895d5a348a3575c6d..91da615d00109a20f73f078e5b80f87bd5520fd4 100644 (file)
--- 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
index 2b4cfde0fce19d98f49bcb13156110c665191ad0..0cab28da1efbd09c81ecb7da13c1665e7d9a4304 100644 (file)
@@ -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
index 100a20c6ee50f01d2b6fdf888e0bb3953c2d3b6e..de74b20319457acea24cf21e5d27a6b24a7216f4 100644 (file)
@@ -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)" % (
index 226283195274e8529f23e3b435101121f110b073..adfe2a8a94d8ea819afd4f9b5c6a1c1de77e02e4 100644 (file)
@@ -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):