From: Mike Bayer Date: Sun, 28 Nov 2010 16:28:27 +0000 (-0500) Subject: - push polymorphic_on not recognized warning to an exception, [ticket:1875] X-Git-Tag: rel_0_7b1~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac5d11afb3fa601d3194bbe8c087c568608985fa;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - push polymorphic_on not recognized warning to an exception, [ticket:1875] --- diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 0721f7376e..be7909a05a 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -606,7 +606,7 @@ class Mapper(object): if self.with_polymorphic is None \ or self.with_polymorphic[1].corresponding_column(col) \ is None: - util.warn("Could not map polymorphic_on column " + raise sa_exc.InvalidRequestError("Could not map polymorphic_on column " "'%s' to the mapped table - polymorphic " "loads will not function properly" % col.description) diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index e7461842f5..c57f1d095f 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -97,7 +97,7 @@ class PolymorphicOnNotLocalTest(_base.MappedTest): polymorphic_identity=0) assert_raises_message( - sa_exc.SAWarning, + sa_exc.InvalidRequestError, "Could not map polymorphic_on column 'x' to the mapped table - " "polymorphic loads will not function properly", go @@ -121,7 +121,7 @@ class PolymorphicOnNotLocalTest(_base.MappedTest): with_polymorphic=('*', t1t2_join_2), polymorphic_identity=0) assert_raises_message( - sa_exc.SAWarning, + sa_exc.InvalidRequestError, "Could not map polymorphic_on column 'x' to the mapped table - " "polymorphic loads will not function properly", go