diff --git a/django/contrib/gis/geoip2.py b/django/contrib/gis/geoip2.py index 4de3e585f0..1e4a464068 100644 --- a/django/contrib/gis/geoip2.py +++ b/django/contrib/gis/geoip2.py @@ -14,13 +14,11 @@ directory corresponding to settings.GEOIP_PATH. import ipaddress import socket -import warnings from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import validate_ipv46_address from django.utils._os import to_path -from django.utils.deprecation import RemovedInDjango60Warning from django.utils.functional import cached_property __all__ = ["HAS_GEOIP2"] @@ -230,12 +228,3 @@ class GeoIP2: from django.contrib.gis.geos import Point return Point(self.lon_lat(query), srid=4326) - - @classmethod - def open(cls, full_path, cache): - warnings.warn( - "GeoIP2.open() is deprecated. Use GeoIP2() instead.", - RemovedInDjango60Warning, - stacklevel=2, - ) - return GeoIP2(full_path, cache) diff --git a/docs/ref/contrib/gis/geoip2.txt b/docs/ref/contrib/gis/geoip2.txt index 89664f6b37..70f8120fc5 100644 --- a/docs/ref/contrib/gis/geoip2.txt +++ b/docs/ref/contrib/gis/geoip2.txt @@ -99,18 +99,6 @@ Keyword Arguments Description Methods ======= -Instantiating -------------- - -.. classmethod:: GeoIP2.open(path, cache) - -This classmethod instantiates the GeoIP object from the given database path -and given cache setting. - -.. deprecated:: 5.1 - - Use the :class:`GeoIP2()` constructor instead. - Querying -------- diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt index 63401e1ac5..a3a817045f 100644 --- a/docs/releases/6.0.txt +++ b/docs/releases/6.0.txt @@ -307,3 +307,5 @@ to remove usage of these features. ``django.utils.itercompat`` module is removed. * The ``django.contrib.gis.geoip2.GeoIP2.coords()`` method is removed. + +* The ``django.contrib.gis.geoip2.GeoIP2.open()`` method is removed. diff --git a/tests/gis_tests/test_geoip2.py b/tests/gis_tests/test_geoip2.py index aa74837e4f..1d4a5e5351 100644 --- a/tests/gis_tests/test_geoip2.py +++ b/tests/gis_tests/test_geoip2.py @@ -7,7 +7,6 @@ from django.conf import settings from django.contrib.gis.geoip2 import HAS_GEOIP2 from django.contrib.gis.geos import GEOSGeometry from django.test import SimpleTestCase, override_settings -from django.utils.deprecation import RemovedInDjango60Warning if HAS_GEOIP2: import geoip2 @@ -201,13 +200,6 @@ class GeoLite2Test(SimpleTestCase): version = f"{m.binary_format_major_version}.{m.binary_format_minor_version}" self.assertEqual(repr(g), f"") - def test_open_deprecation_warning(self): - msg = "GeoIP2.open() is deprecated. Use GeoIP2() instead." - with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx: - g = GeoIP2.open(settings.GEOIP_PATH, GeoIP2.MODE_AUTO) - self.assertTrue(g._reader) - self.assertEqual(ctx.filename, __file__) - @skipUnless(HAS_GEOIP2, "GeoIP2 is required.") @override_settings(