Author: Alex Date: 2009-07-01 21:28:12 -0500 (Wed, 01 Jul 2009) New Revision: 11150
Modified: django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py django/branches/soc2009/multidb/django/core/management/commands/dbshell.py django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py django/branches/soc2009/multidb/django/core/management/commands/sql.py django/branches/soc2009/multidb/django/core/management/commands/sqlall.py django/branches/soc2009/multidb/django/core/management/commands/sqlclear.py django/branches/soc2009/multidb/django/core/management/commands/sqlcustom.py django/branches/soc2009/multidb/django/core/management/commands/sqlflush.py django/branches/soc2009/multidb/django/core/management/commands/sqlindexes.py django/branches/soc2009/multidb/django/core/management/commands/sqlreset.py django/branches/soc2009/multidb/django/core/management/commands/sqlsequencereset.py django/branches/soc2009/multidb/django/db/__init__.py Log: [soc2009/multidb] Replaced a lot of raw strings with the appropriate constant. Thanks to Igor Sobreira for reminding me about these. Modified: django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -1,7 +1,7 @@ from optparse import make_option from django.core.management.base import LabelCommand -from django.db import connections, transaction, models +from django.db import connections, transaction, models, DEFAULT_DB_ALIAS class Command(LabelCommand): help = "Creates the table needed to use the SQL cache backend." @@ -10,8 +10,9 @@ option_list = LabelCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a specific database to install ' - 'the cache table to. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a specific database to ' + 'install the cache table to. Defaults to the "default" ' + 'database.'), ) requires_model_validation = False Modified: django/branches/soc2009/multidb/django/core/management/commands/dbshell.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/dbshell.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/dbshell.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -1,7 +1,7 @@ from optparse import make_option from django.core.management.base import BaseCommand, CommandError -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(BaseCommand): help = ("Runs the command-line client for specified database, or the " @@ -9,8 +9,8 @@ option_list = BaseCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to open a shell for.' - ' Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to open a ' + 'shell for. Defaults to the "default" database.'), ) requires_model_validation = False Modified: django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from optparse import make_option from django.core.management.base import NoArgsCommand, CommandError -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(NoArgsCommand): help = "Introspects the database tables in the given database and outputs a Django model module." option_list = NoArgsCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to introspect. ' - 'Defaults to using the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to ' + 'introspect. Defaults to using the "default" database.'), ) requires_model_validation = False Modified: django/branches/soc2009/multidb/django/core/management/commands/sql.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sql.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sql.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import AppCommand from django.core.management.sql import sql_create -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(AppCommand): help = "Prints the CREATE TABLE SQL statements for the given app name(s)." option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) output_transaction = True Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlall.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlall.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlall.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import AppCommand from django.core.management.sql import sql_all -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(AppCommand): help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s)." option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) output_transaction = True Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlclear.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlclear.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlclear.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import AppCommand from django.core.management.sql import sql_delete -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(AppCommand): help = "Prints the DROP TABLE SQL statements for the given app name(s)." option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) output_transaction = True Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlcustom.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlcustom.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlcustom.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import AppCommand from django.core.management.sql import sql_custom -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(AppCommand): help = "Prints the custom table modifying SQL statements for the given app name(s)." option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) output_transaction = True Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlflush.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlflush.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlflush.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import NoArgsCommand from django.core.management.sql import sql_flush -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(NoArgsCommand): help = "Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed." option_list = NoArgsCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) output_transaction = True Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlindexes.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlindexes.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlindexes.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import AppCommand from django.core.management.sql import sql_indexes -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(AppCommand): help = "Prints the CREATE INDEX SQL statements for the given model module name(s)." option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlreset.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlreset.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlreset.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -2,15 +2,15 @@ from django.core.management.base import AppCommand from django.core.management.sql import sql_reset -from django.db import connections +from django.db import connections, DEFAULT_DB_ALIAS class Command(AppCommand): help = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s)." option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) Modified: django/branches/soc2009/multidb/django/core/management/commands/sqlsequencereset.py =================================================================== --- django/branches/soc2009/multidb/django/core/management/commands/sqlsequencereset.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/core/management/commands/sqlsequencereset.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -1,15 +1,15 @@ from optparse import make_option from django.core.management.base import AppCommand -from django.db import connections, models +from django.db import connections, models, DEFAULT_DB_ALIAS class Command(AppCommand): help = 'Prints the SQL statements for resetting sequences for the given app name(s).' option_list = AppCommand.option_list + ( make_option('--database', action='store', dest='database', - default='default', help='Nominates a database to print the SQL ' - 'for. Defaults to the "default" database.'), + default=DEFAULT_DB_ALIAS, help='Nominates a database to print the ' + 'SQL for. Defaults to the "default" database.'), ) Modified: django/branches/soc2009/multidb/django/db/__init__.py =================================================================== --- django/branches/soc2009/multidb/django/db/__init__.py 2009-07-02 00:28:01 UTC (rev 11149) +++ django/branches/soc2009/multidb/django/db/__init__.py 2009-07-02 02:28:12 UTC (rev 11150) @@ -37,7 +37,7 @@ # by the PostgreSQL backends. # we load all these up for backwards compatibility, you should use # connections['default'] instead. -connection = connections['default'] +connection = connections[DEFAULT_DB_ALIAS] backend = load_backend(connection.settings_dict['DATABASE_ENGINE']) DatabaseError = backend.DatabaseError IntegrityError = backend.IntegrityError --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---