mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
[soc2009/multidb] Fix a number of tests when run under an old style settings (i.e. using the DATABASE_* settings).
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11779 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1dafb9ad6c
commit
e58c73041b
9
TODO
9
TODO
@ -11,6 +11,15 @@ Required for v1.2
|
|||||||
* validate() on a field
|
* validate() on a field
|
||||||
* name/purpose clash with Honza?
|
* name/purpose clash with Honza?
|
||||||
* any overlap with existing methods?
|
* any overlap with existing methods?
|
||||||
|
* Check test failures with old-style (non-multi-db) settings file
|
||||||
|
* custom_pk
|
||||||
|
* backends
|
||||||
|
* Check test failures with MySQL MyISAM
|
||||||
|
* serializers_regress
|
||||||
|
* fixtures
|
||||||
|
* lookup
|
||||||
|
* transactions
|
||||||
|
* model_regress
|
||||||
|
|
||||||
Optional for v1.2
|
Optional for v1.2
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
@ -18,8 +18,18 @@ if not settings.DATABASES:
|
|||||||
PendingDeprecationWarning
|
PendingDeprecationWarning
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if settings.DATABASE_ENGINE in ("postgresql", "postgresql_psycopg2",
|
||||||
|
"sqlite3", "mysql", "oracle"):
|
||||||
|
engine = "django.db.backends.%s" % settings.DATABASE_ENGINE
|
||||||
|
warnings.warn(
|
||||||
|
"Short names for DATABASE_ENGINE are deprecated; prepend with 'django.db.backends.'",
|
||||||
|
PendingDeprecationWarning
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
engine = settings.DATABASE_ENGINE
|
||||||
|
|
||||||
settings.DATABASES[DEFAULT_DB_ALIAS] = {
|
settings.DATABASES[DEFAULT_DB_ALIAS] = {
|
||||||
'ENGINE': settings.DATABASE_ENGINE,
|
'ENGINE': engine,
|
||||||
'HOST': settings.DATABASE_HOST,
|
'HOST': settings.DATABASE_HOST,
|
||||||
'NAME': settings.DATABASE_NAME,
|
'NAME': settings.DATABASE_NAME,
|
||||||
'OPTIONS': settings.DATABASE_OPTIONS,
|
'OPTIONS': settings.DATABASE_OPTIONS,
|
||||||
|
@ -6,13 +6,7 @@ from django.utils.importlib import import_module
|
|||||||
|
|
||||||
def load_backend(backend_name):
|
def load_backend(backend_name):
|
||||||
try:
|
try:
|
||||||
module = import_module('.base', 'django.db.backends.%s' % backend_name)
|
return import_module('.base', 'django.db.backends.%s' % backend_name)
|
||||||
import warnings
|
|
||||||
warnings.warn(
|
|
||||||
"Short names for DATABASE_ENGINE are deprecated; prepend with 'django.db.backends.'",
|
|
||||||
PendingDeprecationWarning
|
|
||||||
)
|
|
||||||
return module
|
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
# Look for a fully qualified database backend name
|
# Look for a fully qualified database backend name
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user