diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-12-08 11:23:21 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-12-08 11:23:21 -0500 |
commit | 1ee4736beaadeb9053f8886503b64ee04fa4b557 (patch) | |
tree | e67e2b6347a11a5eef84ff11d76c142ba53b10ff /lib/sqlalchemy/sql/expression.py | |
parent | d57c1c2ddd654a1077ab04ba7277828d9030c23d (diff) | |
parent | f8caf05593a00a61d5ef6467c334c1e594fbae86 (diff) | |
download | sqlalchemy-1ee4736beaadeb9053f8886503b64ee04fa4b557.tar.gz |
merge latest default
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 42d6393ed..d3379bce5 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1866,10 +1866,10 @@ class ClauseElement(Visitable): def compile(self, bind=None, dialect=None, **kw): """Compile this SQL expression. - The return value is a :class:`~sqlalchemy.engine.Compiled` object. + The return value is a :class:`~.Compiled` object. Calling ``str()`` or ``unicode()`` on the returned value will yield a string representation of the result. The - :class:`~sqlalchemy.engine.Compiled` object also can return a + :class:`~.Compiled` object also can return a dictionary of bind parameter names and values using the ``params`` accessor. @@ -3723,6 +3723,7 @@ class BinaryExpression(ColumnElement): # refer to BinaryExpression directly and pass strings if isinstance(operator, basestring): operator = operators.custom_op(operator) + self._orig = (left, right) self.left = _literal_as_text(left).self_group(against=operator) self.right = _literal_as_text(right).self_group(against=operator) self.operator = operator @@ -3735,9 +3736,9 @@ class BinaryExpression(ColumnElement): self.modifiers = modifiers def __nonzero__(self): - try: - return self.operator(hash(self.left), hash(self.right)) - except: + if self.operator in (operator.eq, operator.ne): + return self.operator(hash(self._orig[0]), hash(self._orig[1])) + else: raise TypeError("Boolean value of this clause is not defined") @property |