summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-04-13 02:00:46 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-04-13 02:00:46 +0000
commitcf08ea496e9d40f2f5b3677feedb59cd600fab91 (patch)
tree6d924bdde5692f596748d2b98edb2523e6cc8962 /django
parentee2b07c7fcf0b7e67029b2f04fe18e369eecf98a (diff)
[1.1.X] Refs #13227 -- Partial backport of r12865; backported the changes to Where tree cloning logic to ensure that unclonable objects in a where() clause don't break querying.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/query_utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
index 5ac08c0619..f6dc533c28 100644
--- a/django/db/models/query_utils.py
+++ b/django/db/models/query_utils.py
@@ -152,7 +152,8 @@ class Q(tree.Node):
def _combine(self, other, conn):
if not isinstance(other, Q):
raise TypeError(other)
- obj = deepcopy(self)
+ obj = type(self)()
+ obj.add(self, conn)
obj.add(other, conn)
return obj
@@ -163,7 +164,8 @@ class Q(tree.Node):
return self._combine(other, self.AND)
def __invert__(self):
- obj = deepcopy(self)
+ obj = type(self)()
+ obj.add(self, self.AND)
obj.negate()
return obj