diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-24 12:15:46 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-24 12:15:46 +0000 |
| commit | dd0c5855e9dc0c88f99c004db544c34eb67cf499 (patch) | |
| tree | 9513f6f3b7d10b53894775e183326d2ffadcd5b4 | |
| parent | 28b1c9c1c95fe6193e234f85f51ec593cac3b861 (diff) | |
queryset-refactor: A few bits of code cleanup.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7454 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/models/sql/query.py | 8 | ||||
| -rw-r--r-- | django/db/models/sql/subqueries.py | 3 |
2 files changed, 4 insertions, 7 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index b8ab1b6fe5..1c22593293 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -357,7 +357,7 @@ class Query(object): the model. """ qn = self.quote_name_unless_alias - result = ['(%s) AS %s' % (col, alias) for alias, col in self.extra_select.items()] + result = ['(%s) AS %s' % (col, alias) for alias, col in self.extra_select.iteritems()] aliases = self.extra_select.keys() if self.select: for col in self.select: @@ -633,7 +633,7 @@ class Query(object): col.relabel_aliases(change_map) # 2. Rename the alias in the internal table/alias datastructures. - for old_alias, new_alias in change_map.items(): + for old_alias, new_alias in change_map.iteritems(): alias_data = list(self.alias_map[old_alias]) alias_data[RHS_ALIAS] = new_alias @@ -657,7 +657,7 @@ class Query(object): break # 3. Update any joins that refer to the old alias. - for alias, data in self.alias_map.items(): + for alias, data in self.alias_map.iteritems(): lhs = data[LHS_ALIAS] if lhs in change_map: data = list(data) @@ -706,7 +706,7 @@ class Query(object): Returns the number of tables in this query with a non-zero reference count. """ - return len([1 for count in self.alias_refcount.values() if count]) + return len([1 for count in self.alias_refcount.itervalues() if count]) def join(self, connection, always_create=False, exclusions=(), promote=False, outer_if_first=False, nullable=False): diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index 2c5a93e417..385bbb3ae8 100644 --- a/django/db/models/sql/subqueries.py +++ b/django/db/models/sql/subqueries.py @@ -295,9 +295,6 @@ class InsertQuery(Query): parameters. This provides a way to insert NULL and DEFAULT keywords into the query, for example. """ - # keys() and values() return items in the same order, providing the - # dictionary hasn't changed between calls. So the dual iteration here - # works as intended. placeholders, values = [], [] for field, val in insert_values: if hasattr(field, 'get_placeholder'): |
