Skip to content

Commit

Permalink
[soc2009/multidb] Replaced a lot of raw strings with the appropriate …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
alex committed Jul 2, 2009
1 parent 5d462b9 commit f73cbae
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 34 deletions.
7 changes: 4 additions & 3 deletions django/core/management/commands/createcachetable.py
@@ -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."
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/dbshell.py
@@ -1,16 +1,16 @@
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 "
"default database if none is provided.")

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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/inspectdb.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sql.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlall.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlclear.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlcustom.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlflush.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlindexes.py
Expand Up @@ -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.'),

)

Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlreset.py
Expand Up @@ -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.'),

)

Expand Down
6 changes: 3 additions & 3 deletions django/core/management/commands/sqlsequencereset.py
@@ -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.'),

)

Expand Down
2 changes: 1 addition & 1 deletion django/db/__init__.py
Expand Up @@ -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
Expand Down

0 comments on commit f73cbae

Please sign in to comment.