summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-14 02:15:03 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-14 02:15:03 +0000
commitfdb3209062b47eea52d5d59e99733950990af345 (patch)
tree697cbdee8707e3e6318f0c37050c7b51dc23267d /django
parent142e400c5cbff91ba70d3636a4429a48131a2edd (diff)
queryset-refactor: Fixed a bug in Node.negate() for already negated nodes.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/utils/tree.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/utils/tree.py b/django/utils/tree.py
index 0dc09e83a2..e40b2b14d8 100644
--- a/django/utils/tree.py
+++ b/django/utils/tree.py
@@ -80,7 +80,8 @@ class Node(object):
Interpreting the meaning of this negate is up to client code. This
method is useful for implementing "not" arrangements.
"""
- self.children = [NegatedNode(self.children, self.connection)]
+ self.children = [NegatedNode(self.children, self.connection,
+ old_state=self.negated)]
self.connection = self.default
def start_subtree(self, conn_type):
@@ -117,7 +118,7 @@ class NegatedNode(Node):
A class that indicates the connection type should be negated (whatever that
means -- it's up to the client) when used by the client code.
"""
- def __init__(self, children=None, connection=None):
+ def __init__(self, children=None, connection=None, old_state=True):
super(NegatedNode, self).__init__(children, connection)
- self.negated = True
+ self.negated = not old_state