summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-04-21 13:35:38 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-04-21 13:35:38 -0400
commit920f77e3c17ec43382e60a992dc4dcec2ba173b8 (patch)
treef1bf8b09a0569a7f3e2c8e1fd35fc63c15bd0930 /lib/sqlalchemy/sql/elements.py
parentae3ffcf4ea2c131c720a584c29ae66444d929b77 (diff)
downloadsqlalchemy-920f77e3c17ec43382e60a992dc4dcec2ba173b8.tar.gz
Add _negate() to Label to negate inner element
Fixed the negation of a :class:`.Label` construct so that the inner element is negated correctly, when the :func:`.not_` modifier is applied to the labeled expression. Change-Id: Ia99917b2959bdfbff28689c962b4203911c57b85 Fixes: #3969
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 414e3f477..1ce03e66a 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -3577,7 +3577,13 @@ class Label(ColumnElement):
return self._element.self_group(against=operators.as_)
def self_group(self, against=None):
- sub_element = self._element.self_group(against=against)
+ return self._apply_to_inner(self._element.self_group, against=against)
+
+ def _negate(self):
+ return self._apply_to_inner(self._element._negate)
+
+ def _apply_to_inner(self, fn, *arg, **kw):
+ sub_element = fn(*arg, **kw)
if sub_element is not self._element:
return Label(self.name,
sub_element,