Author: Alex
Date: 2011-01-13 23:04:14 -0600 (Thu, 13 Jan 2011)
New Revision: 15203

Modified:
   django/trunk/django/db/models/sql/query.py
Log:
Cleaned up the ORM slightly.

Modified: django/trunk/django/db/models/sql/query.py
===================================================================
--- django/trunk/django/db/models/sql/query.py  2011-01-14 03:53:01 UTC (rev 
15202)
+++ django/trunk/django/db/models/sql/query.py  2011-01-14 05:04:14 UTC (rev 
15203)
@@ -1212,11 +1212,10 @@
         dupe_set = set()
         exclusions = set()
         extra_filters = []
+        int_alias = None
         for pos, name in enumerate(names):
-            try:
+            if int_alias is not None:
                 exclusions.add(int_alias)
-            except NameError:
-                pass
             exclusions.add(alias)
             last.append(len(joins))
             if name == 'pk':
@@ -1375,10 +1374,11 @@
                     joins.append(alias)
 
             for (dupe_opts, dupe_col) in dupe_set:
-                try:
-                    self.update_dupe_avoidance(dupe_opts, dupe_col, int_alias)
-                except NameError:
-                    self.update_dupe_avoidance(dupe_opts, dupe_col, alias)
+                if int_alias is None:
+                    to_avoid = alias
+                else:
+                    to_avoid = int_alias
+                self.update_dupe_avoidance(dupe_opts, dupe_col, to_avoid)
 
         if pos != len(names) - 1:
             if pos == len(names) - 2:

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

Reply via email to