From ac5d11afb3fa601d3194bbe8c087c568608985fa Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 28 Nov 2010 11:28:27 -0500 Subject: [PATCH] - push polymorphic_on not recognized warning to an exception, [ticket:1875] --- lib/sqlalchemy/orm/mapper.py | 2 +- test/orm/inheritance/test_basic.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 -- 2.47.3