Fixed a missing variable initialisation deep in the Query bowels.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-09-22 00:31:22 +00:00
parent fd366a8531
commit 922aba3def
2 changed files with 6 additions and 0 deletions

View File

@ -808,6 +808,7 @@ class Query(object):
self.where.relabel_aliases(change_map) self.where.relabel_aliases(change_map)
for pos, col in enumerate(self.select): for pos, col in enumerate(self.select):
if isinstance(col, (list, tuple)): if isinstance(col, (list, tuple)):
old_alias = col[0]
self.select[pos] = (change_map.get(old_alias, old_alias), col[1]) self.select[pos] = (change_map.get(old_alias, old_alias), col[1])
else: else:
col.relabel_aliases(change_map) col.relabel_aliases(change_map)

View File

@ -966,6 +966,11 @@ about them and shouldn't do bad things.
>>> expected == result >>> expected == result
True True
Make sure bump_prefix() (an internal Query method) doesn't (re-)break.
>>> query = Tag.objects.values_list('id').order_by().query
>>> query.bump_prefix()
>>> print query.as_sql()[0]
SELECT U0."id" FROM "queries_tag" U0
"""} """}
# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__ # In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__