diff -ru Django-1.3.1/django/db/models/sql/aggregates.py Django-1.3.1_16759_cleaned_up_where_clone/django/db/models/sql/aggregates.py
old
|
new
|
|
69 | 69 | |
70 | 70 | self.field = tmp |
71 | 71 | |
| 72 | def clone(self): |
| 73 | return self |
| 74 | |
72 | 75 | def relabel_aliases(self, change_map): |
73 | 76 | if isinstance(self.col, (list, tuple)): |
74 | 77 | self.col = (change_map.get(self.col[0], self.col[0]), self.col[1]) |
diff -ru Django-1.3.1/django/db/models/sql/query.py Django-1.3.1_16759_cleaned_up_where_clone/django/db/models/sql/query.py
old
|
new
|
|
244 | 244 | obj.dupe_avoidance = self.dupe_avoidance.copy() |
245 | 245 | obj.select = self.select[:] |
246 | 246 | obj.tables = self.tables[:] |
247 | | obj.where = deepcopy(self.where, memo=memo) |
| 247 | obj.where = self.where.clone() |
248 | 248 | obj.where_class = self.where_class |
249 | 249 | if self.group_by is None: |
250 | 250 | obj.group_by = None |
251 | 251 | else: |
252 | 252 | obj.group_by = self.group_by[:] |
253 | | obj.having = deepcopy(self.having, memo=memo) |
| 253 | obj.having = self.having.clone() |
254 | 254 | obj.order_by = self.order_by[:] |
255 | 255 | obj.low_mark, obj.high_mark = self.low_mark, self.high_mark |
256 | 256 | obj.distinct = self.distinct |
diff -ru Django-1.3.1/django/db/models/sql/where.py Django-1.3.1_16759_cleaned_up_where_clone/django/db/models/sql/where.py
old
|
new
|
|
261 | 261 | def relabel_aliases(self, change_map, node=None): |
262 | 262 | return |
263 | 263 | |
| 264 | def clone(self): |
| 265 | return self |
| 266 | |
264 | 267 | class NothingNode(object): |
265 | 268 | """ |
266 | 269 | A node that matches nothing. |
… |
… |
|
271 | 274 | def relabel_aliases(self, change_map, node=None): |
272 | 275 | return |
273 | 276 | |
| 277 | def clone(self): |
| 278 | return self |
| 279 | |
274 | 280 | class ExtraWhere(object): |
275 | 281 | def __init__(self, sqls, params): |
276 | 282 | self.sqls = sqls |
… |
… |
|
279 | 285 | def as_sql(self, qn=None, connection=None): |
280 | 286 | return " AND ".join(self.sqls), tuple(self.params or ()) |
281 | 287 | |
| 288 | def clone(self): |
| 289 | return self |
| 290 | |
282 | 291 | class Constraint(object): |
283 | 292 | """ |
284 | 293 | An object that can be passed to WhereNode.add() and knows how to |
… |
… |
|
343 | 352 | def relabel_aliases(self, change_map): |
344 | 353 | if self.alias in change_map: |
345 | 354 | self.alias = change_map[self.alias] |
| 355 | |
| 356 | def clone(self): |
| 357 | return Constraint(self.alias, self.col, self.field) |
diff -ru Django-1.3.1/django/utils/tree.py Django-1.3.1_16759_cleaned_up_where_clone/django/utils/tree.py
old
|
new
|
|
45 | 45 | return obj |
46 | 46 | _new_instance = classmethod(_new_instance) |
47 | 47 | |
| 48 | def clone(self): |
| 49 | clone = self.__class__._new_instance( |
| 50 | children=[], connector=self.connector, negated=self.negated) |
| 51 | for child in self.children: |
| 52 | if isinstance(child, tuple): |
| 53 | clone.children.append( |
| 54 | (child[0].clone(), child[1], child[2], child[3])) |
| 55 | else: |
| 56 | clone.children.append(child.clone()) |
| 57 | for parent in self.subtree_parents: |
| 58 | clone.subtree_parents.append(parent.clone()) |
| 59 | return clone |
| 60 | |
48 | 61 | def __str__(self): |
49 | 62 | if self.negated: |
50 | 63 | return '(NOT (%s: %s))' % (self.connector, ', '.join([str(c) for c |