Removed usage of django.db.utils.ConnectionHandler.databases.
This commit is contained in:
parent
e458abc593
commit
58ad9a99a7
|
@ -166,7 +166,7 @@ class ConnectionHandler(BaseConnectionHandler):
|
||||||
where no settings is provided.
|
where no settings is provided.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
conn = self.databases[alias]
|
conn = self.settings[alias]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise self.exception_class(f"The connection '{alias}' doesn't exist.")
|
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.
|
Make sure the test settings are available in the 'TEST' sub-dictionary.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
conn = self.databases[alias]
|
conn = self.settings[alias]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise self.exception_class(f"The connection '{alias}' doesn't exist.")
|
raise self.exception_class(f"The connection '{alias}' doesn't exist.")
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class ConnectionHandler(BaseConnectionHandler):
|
||||||
def create_connection(self, alias):
|
def create_connection(self, alias):
|
||||||
self.ensure_defaults(alias)
|
self.ensure_defaults(alias)
|
||||||
self.prepare_test_settings(alias)
|
self.prepare_test_settings(alias)
|
||||||
db = self.databases[alias]
|
db = self.settings[alias]
|
||||||
backend = load_backend(db["ENGINE"])
|
backend = load_backend(db["ENGINE"])
|
||||||
return backend.DatabaseWrapper(db, alias)
|
return backend.DatabaseWrapper(db, alias)
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ def get_ogr_db_string():
|
||||||
GDAL will create its own connection to the database, so we re-use the
|
GDAL will create its own connection to the database, so we re-use the
|
||||||
connection settings from the Django test.
|
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
|
# Map from the django backend into the OGR driver name and database identifier
|
||||||
# https://gdal.org/drivers/vector/
|
# https://gdal.org/drivers/vector/
|
||||||
|
|
Loading…
Reference in New Issue