Commits

Mike Bayer committed 112024e

- allow compatibility with string ops passed here from custom libraries

Comments (0)

Files changed (1)

lib/sqlalchemy/sql/expression.py

 
     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