Django

Code

Changeset 3892

Show
Ignore:
Timestamp:
10/03/06 08:23:49 (2 years ago)
Author:
russellm
Message:

Cleaned up and clarified some log messages and docstrings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management.py

    r3890 r3892  
    398398 
    399399def get_sql_indexes(app): 
    400     "Returns a list of the CREATE INDEX SQL statements for the given app." 
     400    "Returns a list of the CREATE INDEX SQL statements for all models in the given app." 
    401401    from django.db import models 
    402402    output = [] 
     
    408408 
    409409def _get_sql_index(model): 
    410     "Returns the CREATE INDEX SQL statements for a specific model" 
     410    "Returns the CREATE INDEX SQL statements for a single model" 
    411411    from django.db import backend 
    412412    output = [] 
     
    464464 
    465465    for app in models.get_apps(): 
     466        app_name = app.__name__.split('.')[-2] 
    466467        model_list = models.get_models(app) 
    467468        for model in model_list: 
    468469            # Create the model's database table, if it doesn't already exist. 
    469470            if verbosity >= 2: 
    470                 print "Processing model %s" % model._meta 
     471                print "Processing %s.%s model" % (app_name, model._meta.object_name) 
    471472            if model._meta.db_table in table_list: 
    472473                continue 
     
    488489                if sql: 
    489490                    if verbosity >= 2: 
    490                         print "Creating many-to-many tables for %s model" % model.__name__ 
     491                        print "Creating many-to-many tables for %s.%s model" % (app_name, model._meta.object_name) 
    491492                    for statement in sql: 
    492493                        cursor.execute(statement) 
     
    497498    # to do at this point. 
    498499    for app in models.get_apps(): 
     500        app_name = app.__name__.split('.')[-2] 
    499501        if verbosity >= 2: 
    500             print "Sending post-syncdb signal for application", app.__name__.split('.')[-2] 
     502            print "Running post-sync handlers for application", app_name 
    501503        dispatcher.send(signal=signals.post_syncdb, sender=app, 
    502504            app=app, created_models=created_models, 
     
    510512                if initial_sql: 
    511513                    if verbosity >= 1: 
    512                         print "Installing initial data for %s model" % model._meta.object_name 
     514                        print "Installing initial data for %s.%s model" % model._meta.object_name 
    513515                    try: 
    514516                        for sql in initial_sql: 
    515517                            cursor.execute(sql) 
    516518                    except Exception, e: 
    517                         sys.stderr.write("Failed to install initial SQL data for %s model: %s" % \ 
    518                                             (model._meta.object_name, e)) 
     519                        sys.stderr.write("Failed to install initial SQL data for %s.%s model: %s" % \ 
     520                                            (app_name, model._meta.object_name, e)) 
    519521                        transaction.rollback_unless_managed() 
    520522                    else: 
    521523                        transaction.commit_unless_managed() 
    522  
     524                 
    523525syncdb.args = '' 
    524526