Răsfoiți Sursa

Removed django.contrib.gis.geoip2.GeoIP2.open() per deprecation timeline.

Sarah Boyce 3 luni în urmă
părinte
comite
8d695bf510

+ 0 - 11
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)

+ 0 - 12
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
 --------
 

+ 2 - 0
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.

+ 0 - 8
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"<GeoIP2 [v{version}] _path='{g._path}'>")
 
-    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(