Ticket #14595: 14595.diff
File 14595.diff, 1.7 KB (added by , 14 years ago) |
---|
-
__init__.py
12 12 # For backwards compatibility - Port any old database settings over to 13 13 # the new values. 14 14 if 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 20 16 21 17 settings.DATABASES[DEFAULT_DB_ALIAS] = { 22 18 'ENGINE': settings.DATABASE_ENGINE, … … 30 26 'TEST_COLLATION': settings.TEST_DATABASE_COLLATION, 31 27 'TEST_NAME': settings.TEST_DATABASE_NAME, 32 28 } 29 warnings.warn( 30 "settings.DATABASE_* is deprecated; instead use\nDATABASES = {'default': %s }" % pprint.pformat( settings.DATABASES[DEFAULT_DB_ALIAS] ), 31 DeprecationWarning 32 ) 33 33 34 34 35 if DEFAULT_DB_ALIAS not in settings.DATABASES: 35 36 raise ImproperlyConfigured("You must define a '%s' database" % DEFAULT_DB_ALIAS) … … 53 54 else: 54 55 full_engine = 'django.contrib.gis.db.backends.%s' % database['ENGINE'] 55 56 else: 57 full_engine = "django.db.backends.%s" % database['ENGINE'] 56 58 warnings.warn( 57 59 "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), 59 62 DeprecationWarning 60 63 ) 61 full_engine = "django.db.backends.%s" % database['ENGINE']62 64 database['ENGINE'] = full_engine 63 65 64 66 connections = ConnectionHandler(settings.DATABASES)