summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/utils.py3
-rw-r--r--tests/db_utils/tests.py8
2 files changed, 11 insertions, 0 deletions
diff --git a/django/db/utils.py b/django/db/utils.py
index 3ad83b52ff..e45f1db249 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -183,6 +183,9 @@ class ConnectionHandler(BaseConnectionHandler):
@property
def databases(self):
+ # Maintained for backward compatibility as some 3rd party packages have
+ # made use of this private API in the past. It is no longer used within
+ # Django itself.
return self.settings
def create_connection(self, alias):
diff --git a/tests/db_utils/tests.py b/tests/db_utils/tests.py
index fe1d1e2d60..9c0ec905cc 100644
--- a/tests/db_utils/tests.py
+++ b/tests/db_utils/tests.py
@@ -40,6 +40,14 @@ class ConnectionHandlerTests(SimpleTestCase):
with self.assertRaisesMessage(ImproperlyConfigured, msg):
conns["other"].ensure_connection()
+ def test_databases_property(self):
+ # The "databases" property is maintained for backwards compatibility
+ # with 3rd party packages. It should be an alias of the "settings"
+ # property.
+ conn = ConnectionHandler({})
+ self.assertNotEqual(conn.settings, {})
+ self.assertEqual(conn.settings, conn.databases)
+
def test_nonexistent_alias(self):
msg = "The connection 'nonexistent' doesn't exist."
conns = ConnectionHandler(