Removed usage of django.db.utils.ConnectionHandler.databases.

This commit is contained in:
Florian Apolloner 2022-03-17 07:19:18 +01:00 committed by Mariusz Felisiak
parent e458abc593
commit 58ad9a99a7
2 changed files with 4 additions and 4 deletions

View File

@ -166,7 +166,7 @@ class ConnectionHandler(BaseConnectionHandler):
where no settings is provided.
"""
try:
conn = self.databases[alias]
conn = self.settings[alias]
except KeyError:
raise self.exception_class(f"The connection '{alias}' doesn't exist.")
@ -187,7 +187,7 @@ class ConnectionHandler(BaseConnectionHandler):
Make sure the test settings are available in the 'TEST' sub-dictionary.
"""
try:
conn = self.databases[alias]
conn = self.settings[alias]
except KeyError:
raise self.exception_class(f"The connection '{alias}' doesn't exist.")
@ -205,7 +205,7 @@ class ConnectionHandler(BaseConnectionHandler):
def create_connection(self, alias):
self.ensure_defaults(alias)
self.prepare_test_settings(alias)
db = self.databases[alias]
db = self.settings[alias]
backend = load_backend(db["ENGINE"])
return backend.DatabaseWrapper(db, alias)

View File

@ -204,7 +204,7 @@ def get_ogr_db_string():
GDAL will create its own connection to the database, so we re-use the
connection settings from the Django test.
"""
db = connections.databases["default"]
db = connections.settings["default"]
# Map from the django backend into the OGR driver name and database identifier
# https://gdal.org/drivers/vector/