From: Mike Bayer Date: Mon, 13 Aug 2012 14:57:33 +0000 (-0400) Subject: - allow compatibility with string ops passed here from custom libraries X-Git-Tag: rel_0_8_0b1~257 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=abc5e848177ab6f688255ef2aa4fe4417ced99b0;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - allow compatibility with string ops passed here from custom libraries --- diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index ec1d9c74cd..2c1c047b57 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -3545,6 +3545,10 @@ class BinaryExpression(ColumnElement): def __init__(self, left, right, operator, type_=None, negate=None, modifiers=None): + # allow compatibility with libraries that + # refer to BinaryExpression directly and pass strings + if isinstance(operator, basestring): + operator = operators.custom_op(operator) self.left = _literal_as_text(left).self_group(against=operator) self.right = _literal_as_text(right).self_group(against=operator) self.operator = operator