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.contrib.gis.gdal import CoordTransform, SpatialReference
|
||||||
from django.core.serializers.base import SerializerDoesNotExist
|
from django.core.serializers.base import SerializerDoesNotExist
|
||||||
from django.core.serializers.json import Serializer as JSONSerializer
|
from django.core.serializers.json import Serializer as JSONSerializer
|
||||||
|
@ -50,7 +52,7 @@ class Serializer(JSONSerializer):
|
||||||
srs = SpatialReference(self.srid)
|
srs = SpatialReference(self.srid)
|
||||||
self._cts[self._geometry.srid] = CoordTransform(self._geometry.srs, srs)
|
self._cts[self._geometry.srid] = CoordTransform(self._geometry.srs, srs)
|
||||||
self._geometry.transform(self._cts[self._geometry.srid])
|
self._geometry.transform(self._cts[self._geometry.srid])
|
||||||
data["geometry"] = eval(self._geometry.geojson)
|
data["geometry"] = json.loads(self._geometry.geojson)
|
||||||
else:
|
else:
|
||||||
data["geometry"] = None
|
data["geometry"] = None
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Reference in New Issue