mirror of https://github.com/django/django.git
Fixed #33287 -- Made GeoJSON serializer use json.loads() instead of eval().
Thanks David Wyde for the report.
This commit is contained in:
parent
76f07b4fcf
commit
12fe3224f5
|
@ -1,3 +1,5 @@
|
|||
import json
|
||||
|
||||
from django.contrib.gis.gdal import CoordTransform, SpatialReference
|
||||
from django.core.serializers.base import SerializerDoesNotExist
|
||||
from django.core.serializers.json import Serializer as JSONSerializer
|
||||
|
@ -50,7 +52,7 @@ class Serializer(JSONSerializer):
|
|||
srs = SpatialReference(self.srid)
|
||||
self._cts[self._geometry.srid] = CoordTransform(self._geometry.srs, srs)
|
||||
self._geometry.transform(self._cts[self._geometry.srid])
|
||||
data["geometry"] = eval(self._geometry.geojson)
|
||||
data["geometry"] = json.loads(self._geometry.geojson)
|
||||
else:
|
||||
data["geometry"] = None
|
||||
return data
|
||||
|
|
Loading…
Reference in New Issue