Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cleaned up and clarified some log messages and docstrings.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3892 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b08a8dbb6569b0dac5d14320f3d7eee863d6fcc9 1 parent d886e71
Russell Keith-Magee authored

Showing 1 changed file with 11 additions and 9 deletions. Show diff stats Hide diff stats

  1. 20  django/core/management.py
20  django/core/management.py
@@ -397,7 +397,7 @@ def get_sql_sequence_reset(app):
397 397
 get_sql_sequence_reset.args = APP_ARGS
398 398
 
399 399
 def 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."
401 401
     from django.db import models
402 402
     output = []
403 403
     for model in models.get_models(app):
@@ -407,7 +407,7 @@ def get_sql_indexes(app):
407 407
 get_sql_indexes.args = APP_ARGS
408 408
 
409 409
 def _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"
411 411
     from django.db import backend
412 412
     output = []
413 413
 
@@ -463,11 +463,12 @@ def syncdb(verbosity=1, interactive=True):
463 463
     pending_references = {}
464 464
 
465 465
     for app in models.get_apps():
  466
+        app_name = app.__name__.split('.')[-2]
466 467
         model_list = models.get_models(app)
467 468
         for model in model_list:
468 469
             # Create the model's database table, if it doesn't already exist.
469 470
             if verbosity >= 2:
470  
-                print "Processing model %s" % model._meta
  471
+                print "Processing %s.%s model" % (app_name, model._meta.object_name)
471 472
             if model._meta.db_table in table_list:
472 473
                 continue
473 474
             sql, references = _get_sql_model_create(model, seen_models)
@@ -487,7 +488,7 @@ def syncdb(verbosity=1, interactive=True):
487 488
                 sql = _get_many_to_many_sql_for_model(model)
488 489
                 if sql:
489 490
                     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)
491 492
                     for statement in sql:
492 493
                         cursor.execute(statement)
493 494
 
@@ -496,8 +497,9 @@ def syncdb(verbosity=1, interactive=True):
496 497
     # Send the post_syncdb signal, so individual apps can do whatever they need
497 498
     # to do at this point.
498 499
     for app in models.get_apps():
  500
+        app_name = app.__name__.split('.')[-2]
499 501
         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
501 503
         dispatcher.send(signal=signals.post_syncdb, sender=app,
502 504
             app=app, created_models=created_models,
503 505
             verbosity=verbosity, interactive=interactive)
@@ -509,17 +511,17 @@ def syncdb(verbosity=1, interactive=True):
509 511
                 initial_sql = get_sql_initial_data_for_model(model)
510 512
                 if initial_sql:
511 513
                     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
513 515
                     try:
514 516
                         for sql in initial_sql:
515 517
                             cursor.execute(sql)
516 518
                     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))
519 521
                         transaction.rollback_unless_managed()
520 522
                     else:
521 523
                         transaction.commit_unless_managed()
522  
-
  524
+                
523 525
 syncdb.args = ''
524 526
 
525 527
 def get_admin_index(app):

0 notes on commit b08a8db

Please sign in to comment.
Something went wrong with that request. Please try again.