summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-07-18 18:51:35 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-07-18 18:51:35 +0000
commit7f3bb10cb6dc5a22b912015291d7f10783bd9cc4 (patch)
tree729467a7675083d7b051a16e960c2a2503ccd3b9 /lib/sqlalchemy/sql.py
parent68f706b5bab5cd13ab77f75d1f09a32871b03031 (diff)
downloadsqlalchemy-7f3bb10cb6dc5a22b912015291d7f10783bd9cc4.tar.gz
- 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]
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py8
1 files changed, 7 insertions, 1 deletions
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):