diff --git a/django/db/__init__.py b/django/db/__init__.py index f3cf4574a961..eb8118adb5c9 100644 --- a/django/db/__init__.py +++ b/django/db/__init__.py @@ -17,6 +17,7 @@ from django.utils.connection import ConnectionProxy __all__ = [ + "close_old_connections", "connection", "connections", "router", diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt index f40daf4dfbdf..0ca63830ea0a 100644 --- a/docs/intro/reusable-apps.txt +++ b/docs/intro/reusable-apps.txt @@ -76,7 +76,7 @@ After the previous tutorials, our project should look like this: static/ polls/ images/ - background.gif + background.png style.css templates/ polls/ diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 5a31ceeaaead..d98d523db581 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -99,7 +99,8 @@ connections. If a connection is created in a long-running process, outside of Django’s request-response cycle, the connection will remain open until explicitly -closed, or timeout occurs. +closed, or timeout occurs. You can use ``django.db.close_old_connections()`` to +close all old or unusable connections. Encoding -------- diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index a8d32b2fea49..75d33b5e7ee0 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -1608,7 +1608,7 @@ Helper functions Defaults to :setting:`settings.LOGIN_URL ` if not supplied. * ``redirect_field_name``: The name of a ``GET`` field containing the - URL to redirect to after log out. Overrides ``next`` if the given + URL to redirect to after login. Overrides ``next`` if the given ``GET`` parameter is passed. .. _built-in-auth-forms: diff --git a/tests/gis_tests/gdal_tests/test_geom.py b/tests/gis_tests/gdal_tests/test_geom.py index eba90504b26f..9d62bcd07b31 100644 --- a/tests/gis_tests/gdal_tests/test_geom.py +++ b/tests/gis_tests/gdal_tests/test_geom.py @@ -727,3 +727,86 @@ def test_is_3d_and_set_3d(self): msg = "Input to 'set_3d' must be a boolean, got 'None'" with self.assertRaisesMessage(ValueError, msg): geom.set_3d(None) + + def test_wkt_and_wkb_output(self): + tests = [ + # 2D + ("POINT (1 2)", "0101000000000000000000f03f0000000000000040"), + ( + "LINESTRING (30 10,10 30)", + "0102000000020000000000000000003e400000000000002" + "44000000000000024400000000000003e40", + ), + ( + "POLYGON ((30 10,40 40,20 40,30 10))", + "010300000001000000040000000000000000003e400000000000002440000000000000" + "44400000000000004440000000000000344000000000000044400000000000003e4000" + "00000000002440", + ), + ( + "MULTIPOINT (10 40,40 30)", + "0104000000020000000101000000000000000000244000000000000044400101000000" + "00000000000044400000000000003e40", + ), + ( + "MULTILINESTRING ((10 10,20 20),(40 40,30 30,40 20))", + "0105000000020000000102000000020000000000000000002440000000000000244000" + "0000000000344000000000000034400102000000030000000000000000004440000000" + "00000044400000000000003e400000000000003e400000000000004440000000000000" + "3440", + ), + ( + "MULTIPOLYGON (((30 20,45 40,10 40,30 20)),((15 5,40 10,10 20,15 5)))", + "010600000002000000010300000001000000040000000000000000003e400000000000" + "0034400000000000804640000000000000444000000000000024400000000000004440" + "0000000000003e40000000000000344001030000000100000004000000000000000000" + "2e40000000000000144000000000000044400000000000002440000000000000244000" + "000000000034400000000000002e400000000000001440", + ), + ( + "GEOMETRYCOLLECTION (POINT (40 10))", + "010700000001000000010100000000000000000044400000000000002440", + ), + # 3D + ( + "POINT (1 2 3)", + "0101000080000000000000f03f00000000000000400000000000000840", + ), + ( + "LINESTRING (30 10 3,10 30 3)", + "0102000080020000000000000000003e40000000000000244000000000000008400000" + "0000000024400000000000003e400000000000000840", + ), + ( + "POLYGON ((30 10 3,40 40 3,30 10 3))", + "010300008001000000030000000000000000003e400000000000002440000000000000" + "08400000000000004440000000000000444000000000000008400000000000003e4000" + "000000000024400000000000000840", + ), + ( + "MULTIPOINT (10 40 3,40 30 3)", + "0104000080020000000101000080000000000000244000000000000044400000000000" + "000840010100008000000000000044400000000000003e400000000000000840", + ), + ( + "MULTILINESTRING ((10 10 3,20 20 3))", + "0105000080010000000102000080020000000000000000002440000000000000244000" + "00000000000840000000000000344000000000000034400000000000000840", + ), + ( + "MULTIPOLYGON (((30 20 3,45 40 3,30 20 3)))", + "010600008001000000010300008001000000030000000000000000003e400000000000" + "0034400000000000000840000000000080464000000000000044400000000000000840" + "0000000000003e4000000000000034400000000000000840", + ), + ( + "GEOMETRYCOLLECTION (POINT (40 10 3))", + "0107000080010000000101000080000000000000444000000000000024400000000000" + "000840", + ), + ] + for geom, wkb in tests: + with self.subTest(geom=geom): + g = OGRGeometry(geom) + self.assertEqual(g.wkt, geom) + self.assertEqual(g.wkb.hex(), wkb)