Ticket #14595: 14595.diff

File 14595.diff, 1.7 KB (added by CarlFK, 14 years ago)
  • __init__.py

     
    1212# For backwards compatibility - Port any old database settings over to
    1313# the new values.
    1414if not settings.DATABASES:
    15     import warnings
    16     warnings.warn(
    17         "settings.DATABASE_* is deprecated; use settings.DATABASES instead.",
    18         DeprecationWarning
    19     )
     15    import warnings, pprint
    2016
    2117    settings.DATABASES[DEFAULT_DB_ALIAS] = {
    2218        'ENGINE': settings.DATABASE_ENGINE,
     
    3026        'TEST_COLLATION': settings.TEST_DATABASE_COLLATION,
    3127        'TEST_NAME': settings.TEST_DATABASE_NAME,
    3228    }
     29    warnings.warn(
     30        "settings.DATABASE_* is deprecated; instead use\nDATABASES =  {'default': %s }" % pprint.pformat( settings.DATABASES[DEFAULT_DB_ALIAS] ),
     31        DeprecationWarning
     32    )
     33   
    3334
    3435if DEFAULT_DB_ALIAS not in settings.DATABASES:
    3536    raise ImproperlyConfigured("You must define a '%s' database" % DEFAULT_DB_ALIAS)
     
    5354            else:
    5455                full_engine = 'django.contrib.gis.db.backends.%s' % database['ENGINE']
    5556        else:
     57            full_engine = "django.db.backends.%s" % database['ENGINE']
    5658            warnings.warn(
    5759                "Short names for ENGINE in database configurations are deprecated. "
    58                 "Prepend %s.ENGINE with 'django.db.backends.'" % alias,
     60                "Prepend %s.ENGINE with 'django.db.backends.'\n %s"
     61                    % (alias, full_engine),
    5962                DeprecationWarning
    6063            )
    61             full_engine = "django.db.backends.%s" % database['ENGINE']
    6264        database['ENGINE'] = full_engine
    6365
    6466connections = ConnectionHandler(settings.DATABASES)
Back to Top