From cfcd4a5875ae3368b6c2f88299d8c8c85dba0c55 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 11 Jul 2006 03:35:17 +0000 Subject: [PATCH] Added local 'qn' variable for backend.quote_name in django.db.models.query.fill_table_cache git-svn-id: http://code.djangoproject.com/svn/django/trunk@3326 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index 70400be1e7..d62772f39b 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -667,20 +667,20 @@ 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. """ + qn = backend.quote_name for f in opts.fields: if f.rel and not f.null: db_table = f.rel.to._meta.db_table if db_table not in cache_tables_seen: - tables.append(backend.quote_name(db_table)) + tables.append(qn(db_table)) else: # The table was already seen, so give it a table alias. new_prefix = '%s%s' % (db_table, len(cache_tables_seen)) - tables.append('%s %s' % (backend.quote_name(db_table), backend.quote_name(new_prefix))) + tables.append('%s %s' % (qn(db_table), qn(new_prefix))) db_table = new_prefix cache_tables_seen.append(db_table) where.append('%s.%s = %s.%s' % \ - (backend.quote_name(old_prefix), backend.quote_name(f.column), - backend.quote_name(db_table), backend.quote_name(f.rel.get_related_field().column))) - select.extend(['%s.%s' % (backend.quote_name(db_table), backend.quote_name(f2.column)) for f2 in f.rel.to._meta.fields]) + (qn(old_prefix), qn(f.column), qn(db_table), qn(f.rel.get_related_field().column))) + select.extend(['%s.%s' % (qn(db_table), qn(f2.column)) for f2 in f.rel.to._meta.fields]) fill_table_cache(f.rel.to._meta, select, tables, where, db_table, cache_tables_seen) def parse_lookup(kwarg_items, opts):