From 7f3bb10cb6dc5a22b912015291d7f10783bd9cc4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 18 Jul 2007 18:51:35 +0000 Subject: - merged some more of the SessionTransaction connection-bound checks from 0.4 - _BinaryExpression.compare() checks for a base set of "commutative" operators and checks for itself in reverse if so - added ORM-based unit test for the above, fixes [ticket:664] --- lib/sqlalchemy/sql.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql.py') diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 4c720dfa2..fecb5350b 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -2210,7 +2210,13 @@ class _BinaryExpression(ColumnElement): return ( isinstance(other, _BinaryExpression) and self.operator == other.operator and - self.left.compare(other.left) and self.right.compare(other.right) + ( + self.left.compare(other.left) and self.right.compare(other.right) + or ( + self.operator in ['=', '!=', '+', '*'] and + self.left.compare(other.right) and self.right.compare(other.left) + ) + ) ) def self_group(self, against=None): -- cgit v1.2.1