mirror of
https://github.com/django/django.git
synced 2025-07-05 02:09:13 +00:00
[soc2009/multidb] Replaced a lot of raw strings with the appropriate constant. Thanks to Igor Sobreira for reminding me about these.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5d462b9ec1
commit
f73cbaea67
@ -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 @@ class Command(LabelCommand):
|
||||
|
||||
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
|
||||
|
@ -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 @@ class Command(BaseCommand):
|
||||
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ import keyword
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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.'),
|
||||
|
||||
)
|
||||
|
||||
|
@ -2,15 +2,15 @@ from optparse import make_option
|
||||
|
||||
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.'),
|
||||
|
||||
)
|
||||
|
||||
|
@ -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.'),
|
||||
|
||||
)
|
||||
|
||||
|
@ -37,7 +37,7 @@ connections = ConnectionHandler(settings.DATABASES)
|
||||
# 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user