From 56976624169af6d0d329b4834ee9caa7243573dc Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 21 Oct 2013 15:06:41 -0400 Subject: - Fixed bug where :func:`.type_coerce` would not interpret ORM elements with a ``__clause_element__()`` method properly. [ticket:2849] --- lib/sqlalchemy/sql/elements.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index f70496418..251102d59 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -117,8 +117,8 @@ def type_coerce(expr, type_): """ type_ = type_api.to_instance(type_) - if hasattr(expr, '__clause_expr__'): - return type_coerce(expr.__clause_expr__()) + if hasattr(expr, '__clause_element__'): + return type_coerce(expr.__clause_element__(), type_) elif isinstance(expr, BindParameter): bp = expr._clone() bp.type = type_ -- cgit v1.2.1