Variable renaming. I didn't feel comfortable with the tricky re-aliasing in the line table_list=table_list().

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6290 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-09-15 16:18:44 +00:00
parent d30badc0ec
commit 1788b0c96f
1 changed files with 4 additions and 4 deletions

View File

@ -40,14 +40,14 @@ class Command(NoArgsCommand):
# Get a list of all existing database tables, # Get a list of all existing database tables,
# so we know what needs to be added. # so we know what needs to be added.
table_list = table_list() tables = table_list()
if connection.features.uses_case_insensitive_names: if connection.features.uses_case_insensitive_names:
table_name_converter = str.upper table_name_converter = str.upper
else: else:
table_name_converter = lambda x: x table_name_converter = lambda x: x
# Get a list of already installed *models* so that references work right. # Get a list of already installed *models* so that references work right.
seen_models = installed_models(table_list) seen_models = installed_models(tables)
created_models = set() created_models = set()
pending_references = {} pending_references = {}
@ -59,7 +59,7 @@ class Command(NoArgsCommand):
# Create the model's database table, if it doesn't already exist. # Create the model's database table, if it doesn't already exist.
if verbosity >= 2: if verbosity >= 2:
print "Processing %s.%s model" % (app_name, model._meta.object_name) print "Processing %s.%s model" % (app_name, model._meta.object_name)
if table_name_converter(model._meta.db_table) in table_list: if table_name_converter(model._meta.db_table) in tables:
continue continue
sql, references = sql_model_create(model, self.style, seen_models) sql, references = sql_model_create(model, self.style, seen_models)
seen_models.add(model) seen_models.add(model)
@ -71,7 +71,7 @@ class Command(NoArgsCommand):
print "Creating table %s" % model._meta.db_table print "Creating table %s" % model._meta.db_table
for statement in sql: for statement in sql:
cursor.execute(statement) cursor.execute(statement)
table_list.append(table_name_converter(model._meta.db_table)) tables.append(table_name_converter(model._meta.db_table))
# Create the m2m tables. This must be done after all tables have been created # Create the m2m tables. This must be done after all tables have been created
# to ensure that all referred tables will exist. # to ensure that all referred tables will exist.