mirror of
https://github.com/django/django.git
synced 2024-12-28 12:06:22 +00:00
[4.2.x] Refs #34302 -- Fixed SpatialReference.auth_name()/auth_code() when target is None.
force_bytes() turns None into the byte string b"None". Since
ctypes.c_char_p() also accepts None, we can bypass force_bytes() if
target is None.
Backport of d77762de03
from main
This commit is contained in:
parent
610cd06c3f
commit
341f33ed15
@ -158,11 +158,15 @@ class SpatialReference(GDALBase):
|
|||||||
|
|
||||||
def auth_name(self, target):
|
def auth_name(self, target):
|
||||||
"Return the authority name for the given string target node."
|
"Return the authority name for the given string target node."
|
||||||
return capi.get_auth_name(self.ptr, force_bytes(target))
|
return capi.get_auth_name(
|
||||||
|
self.ptr, target if target is None else force_bytes(target)
|
||||||
|
)
|
||||||
|
|
||||||
def auth_code(self, target):
|
def auth_code(self, target):
|
||||||
"Return the authority code for the given string target node."
|
"Return the authority code for the given string target node."
|
||||||
return capi.get_auth_code(self.ptr, force_bytes(target))
|
return capi.get_auth_code(
|
||||||
|
self.ptr, target if target is None else force_bytes(target)
|
||||||
|
)
|
||||||
|
|
||||||
def clone(self):
|
def clone(self):
|
||||||
"Return a clone of this SpatialReference object."
|
"Return a clone of this SpatialReference object."
|
||||||
|
@ -35,7 +35,11 @@ srlist = (
|
|||||||
ang_name="degree",
|
ang_name="degree",
|
||||||
lin_units=1.0,
|
lin_units=1.0,
|
||||||
ang_units=0.0174532925199,
|
ang_units=0.0174532925199,
|
||||||
auth={"GEOGCS": ("EPSG", "4326"), "spheroid": ("EPSG", "7030")},
|
auth={
|
||||||
|
None: ("EPSG", "4326"), # Top-level authority.
|
||||||
|
"GEOGCS": ("EPSG", "4326"),
|
||||||
|
"spheroid": ("EPSG", "7030"),
|
||||||
|
},
|
||||||
attr=(
|
attr=(
|
||||||
("DATUM", "WGS_1984"),
|
("DATUM", "WGS_1984"),
|
||||||
(("SPHEROID", 1), "6378137"),
|
(("SPHEROID", 1), "6378137"),
|
||||||
@ -64,6 +68,7 @@ srlist = (
|
|||||||
lin_units=1.0,
|
lin_units=1.0,
|
||||||
ang_units=0.0174532925199,
|
ang_units=0.0174532925199,
|
||||||
auth={
|
auth={
|
||||||
|
None: ("EPSG", "32140"), # Top-level authority.
|
||||||
"PROJCS": ("EPSG", "32140"),
|
"PROJCS": ("EPSG", "32140"),
|
||||||
"spheroid": ("EPSG", "7019"),
|
"spheroid": ("EPSG", "7019"),
|
||||||
"unit": ("EPSG", "9001"),
|
"unit": ("EPSG", "9001"),
|
||||||
|
Loading…
Reference in New Issue
Block a user