diff options
| author | David Smith <smithdc@gmail.com> | 2024-11-08 08:00:05 +0000 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-21 22:23:29 -0300 |
| commit | 14fc2e97036fc9d7acb55ada4f16f1aa3bdc5ec7 (patch) | |
| tree | 1809dbc526129f7ecb5dd27df490042421cfe521 /django | |
| parent | 414253866b3671c6f5600a9c39b5709effe16cce (diff) | |
Improved consistency of GEOS error messages.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/geos/coordseq.py | 4 | ||||
| -rw-r--r-- | django/contrib/gis/geos/geometry.py | 6 | ||||
| -rw-r--r-- | django/contrib/gis/geos/polygon.py | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/django/contrib/gis/geos/coordseq.py b/django/contrib/gis/geos/coordseq.py index 484b53ab5f..a9ec4d2bf0 100644 --- a/django/contrib/gis/geos/coordseq.py +++ b/django/contrib/gis/geos/coordseq.py @@ -70,12 +70,12 @@ class GEOSCoordSeq(GEOSBase): def _checkindex(self, index): "Check the given index." if not (0 <= index < self.size): - raise IndexError("invalid GEOS Geometry index: %s" % index) + raise IndexError(f"Invalid GEOS Geometry index: {index}") def _checkdim(self, dim): "Check the given dimension." if dim < 0 or dim > 2: - raise GEOSException('invalid ordinate dimension "%d"' % dim) + raise GEOSException(f'Invalid ordinate dimension: "{dim:d}"') def _get_x(self, index): return capi.cs_getx(self.ptr, index, byref(c_double())) diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 564b0be16e..477b7afa5e 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -353,7 +353,7 @@ class GEOSGeometryBase(GEOSBase): two Geometries match the elements in pattern. """ if not isinstance(pattern, str) or len(pattern) > 9: - raise GEOSException("invalid intersection matrix pattern") + raise GEOSException("Invalid intersection matrix pattern.") return capi.geos_relatepattern(self.ptr, other.ptr, force_bytes(pattern)) def touches(self, other): @@ -506,7 +506,9 @@ class GEOSGeometryBase(GEOSBase): # source SRS. srid = None elif srid is None or srid < 0: - raise GEOSException("Calling transform() with no SRID set is not supported") + raise GEOSException( + "Calling transform() with no SRID set is not supported." + ) # Creating an OGR Geometry, which is then transformed. g = gdal.OGRGeometry(self._ogr_ptr(), srid) diff --git a/django/contrib/gis/geos/polygon.py b/django/contrib/gis/geos/polygon.py index 6f76b57005..9e8d30647b 100644 --- a/django/contrib/gis/geos/polygon.py +++ b/django/contrib/gis/geos/polygon.py @@ -103,7 +103,7 @@ class Polygon(GEOSGeometry): param, msg=( "Parameter must be a sequence of LinearRings or objects that can " - "initialize to LinearRings" + "initialize to LinearRings." ), ): "Try to construct a ring from the given parameter." |
