Ticket #12428: 12428.diff

File 12428.diff, 2.4 KB (added by simon, 5 years ago)

Patch from Alex Gaynor

  • django/db/__init__.py

    diff --git a/django/db/__init__.py b/django/db/__init__.py
    index 2971b67..3771463 100644
    a b if not settings.DATABASES: 
    1717        "settings.DATABASE_* is deprecated; use settings.DATABASES instead.",
    1818        PendingDeprecationWarning
    1919    )
     20   
     21    if not settings.DATABASE_ENGINE:
     22        settings.DATABASE_ENGINE = "dummy"
    2023
    2124    settings.DATABASES[DEFAULT_DB_ALIAS] = {
    2225        'ENGINE': settings.DATABASE_ENGINE,
    if DEFAULT_DB_ALIAS not in settings.DATABASES: 
    3538    raise ImproperlyConfigured("You must default a '%s' database" % DEFAULT_DB_ALIAS)
    3639
    3740for alias, database in settings.DATABASES.items():
    38     if database['ENGINE'] in ("postgresql", "postgresql_psycopg2", "sqlite3", "mysql", "oracle"):
     41    if database['ENGINE'] in ("postgresql", "postgresql_psycopg2", "sqlite3", "mysql", "oracle", "dummy", ""):
    3942        import warnings
    4043        if 'django.contrib.gis' in settings.INSTALLED_APPS:
    4144            warnings.warn(
    for alias, database in settings.DATABASES.items(): 
    5154            else:
    5255                full_engine = 'django.contrib.gis.db.backends.%s' % database['ENGINE']
    5356        else:
     57            if not database['ENGINE']:
     58                database['ENGINE'] = 'dummy'
    5459            warnings.warn(
    5560                "Short names for ENGINE in database configurations are deprecated. "
    5661                "Prepend %s.ENGINE with 'django.db.backends.'" % alias,
    for alias, database in settings.DATABASES.items(): 
    5863            )
    5964            full_engine = "django.db.backends.%s" % database['ENGINE']
    6065        database['ENGINE'] = full_engine
     66    elif database['ENGINE'] == "django.db.backends.":
     67        database['ENGINE'] = "django.db.backends.dummy"
    6168
    6269connections = ConnectionHandler(settings.DATABASES)
    6370
  • django/db/backends/dummy/base.py

    diff --git a/django/db/backends/dummy/base.py b/django/db/backends/dummy/base.py
    index e3ab456..c8bf4c0 100644
    a b class DatabaseWrapper(object): 
    4747        self.client = DatabaseClient(self)
    4848        self.creation = BaseDatabaseCreation(self)
    4949        self.introspection = DatabaseIntrospection(self)
    50         self.validation = BaseDatabaseValidation()
     50        self.validation = BaseDatabaseValidation(self)
     51        self.settings_dict = args[0]
    5152
    5253    def close(self):
    5354        pass
Back to Top