Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Negligible space changes to django/db/models/query.py

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4ee7a7be95060746393b05cbe8b622fef21f56cd 1 parent bbeb62c
@adrianholovaty adrianholovaty authored
Showing with 11 additions and 11 deletions.
  1. +11 −11 django/db/models/query.py
View
22 django/db/models/query.py
@@ -189,7 +189,7 @@ def iterator(self):
raise StopIteration
for row in rows:
if fill_cache:
- obj, index_end = get_cached_row(klass=self.model, row=row,
+ obj, index_end = get_cached_row(klass=self.model, row=row,
index_start=0, max_depth=self._max_related_depth)
else:
obj = self.model(*row[:index_end])
@@ -201,14 +201,14 @@ def count(self):
"""
Performs a SELECT COUNT() and returns the number of records as an
integer.
-
+
If the queryset is already cached (i.e. self._result_cache is set) this
simply returns the length of the cached results set to avoid multiple
SELECT COUNT(*) calls.
"""
if self._result_cache is not None:
return len(self._result_cache)
-
+
counter = self._clone()
counter._order_by = ()
counter._select_related = False
@@ -488,9 +488,9 @@ def _get_sql_clause(self):
# Add additional tables and WHERE clauses based on select_related.
if self._select_related:
- fill_table_cache(opts, select, tables, where,
- old_prefix=opts.db_table,
- cache_tables_seen=[opts.db_table],
+ fill_table_cache(opts, select, tables, where,
+ old_prefix=opts.db_table,
+ cache_tables_seen=[opts.db_table],
max_depth=self._max_related_depth)
# Add any additional SELECTs.
@@ -738,11 +738,11 @@ def get_where_clause(lookup_type, table_prefix, field_name, value):
def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0):
"""Helper function that recursively returns an object with cache filled"""
-
+
# If we've got a max_depth set and we've exceeded that depth, bail now.
if max_depth and cur_depth > max_depth:
return None
-
+
index_end = index_start + len(klass._meta.fields)
obj = klass(*row[index_start:index_end])
for f in klass._meta.fields:
@@ -758,11 +758,11 @@ def fill_table_cache(opts, select, tables, where, old_prefix, cache_tables_seen,
Helper function that recursively populates the select, tables and where (in
place) for select_related queries.
"""
-
+
# If we've got a max_depth set and we've exceeded that depth, bail now.
if max_depth and cur_depth > max_depth:
return None
-
+
qn = backend.quote_name
for f in opts.fields:
if f.rel and not f.null:
@@ -826,7 +826,7 @@ def parse_lookup(kwarg_items, opts):
# Interpret '__exact=None' as the sql '= NULL'; otherwise, reject
# all uses of None as a query value.
if lookup_type != 'exact':
- raise ValueError, "Cannot use None as a query value"
+ raise ValueError, "Cannot use None as a query value"
elif callable(value):
value = value()
Please sign in to comment.
Something went wrong with that request. Please try again.