Small code clarification in prefetch_related code using better variable names

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17162 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2011-11-29 12:50:10 +00:00
parent 16ad0530c5
commit f2ebb169f9
1 changed files with 2 additions and 3 deletions

View File

@ -1576,12 +1576,11 @@ def prefetch_related_objects(result_cache, related_lookups):
done_lookups = set() # list of lookups like foo__bar__baz done_lookups = set() # list of lookups like foo__bar__baz
done_queries = {} # dictionary of things like 'foo__bar': [results] done_queries = {} # dictionary of things like 'foo__bar': [results]
manual_lookups = list(related_lookups)
auto_lookups = [] # we add to this as we go through. auto_lookups = [] # we add to this as we go through.
followed_descriptors = set() # recursion protection followed_descriptors = set() # recursion protection
related_lookups = itertools.chain(manual_lookups, auto_lookups) all_lookups = itertools.chain(related_lookups, auto_lookups)
for lookup in related_lookups: for lookup in all_lookups:
if lookup in done_lookups: if lookup in done_lookups:
# We've done exactly this already, skip the whole thing # We've done exactly this already, skip the whole thing
continue continue