1
0
mirror of https://github.com/django/django.git synced 2025-07-06 10:49:17 +00:00

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
This commit is contained in:
Malcolm Tredinnick 2007-10-14 02:15:03 +00:00
parent 142e400c5c
commit fdb3209062

View File

@ -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