Author: mtredinnick
Date: 2008-09-21 19:31:22 -0500 (Sun, 21 Sep 2008)
New Revision: 9081

Modified:
   django/trunk/django/db/models/sql/query.py
   django/trunk/tests/regressiontests/queries/models.py
Log:
Fixed a missing variable initialisation deep in the Query bowels.


Modified: django/trunk/django/db/models/sql/query.py
===================================================================
--- django/trunk/django/db/models/sql/query.py  2008-09-21 16:57:26 UTC (rev 
9080)
+++ django/trunk/django/db/models/sql/query.py  2008-09-22 00:31:22 UTC (rev 
9081)
@@ -808,6 +808,7 @@
         self.where.relabel_aliases(change_map)
         for pos, col in enumerate(self.select):
             if isinstance(col, (list, tuple)):
+                old_alias = col[0]
                 self.select[pos] = (change_map.get(old_alias, old_alias), 
col[1])
             else:
                 col.relabel_aliases(change_map)

Modified: django/trunk/tests/regressiontests/queries/models.py
===================================================================
--- django/trunk/tests/regressiontests/queries/models.py        2008-09-21 
16:57:26 UTC (rev 9080)
+++ django/trunk/tests/regressiontests/queries/models.py        2008-09-22 
00:31:22 UTC (rev 9081)
@@ -966,6 +966,11 @@
 >>> expected == result
 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__


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to