summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-01-10 18:51:09 +0100
committerClaude Paroz <claude@2xlibre.net>2015-01-10 18:53:55 +0100
commitb86107ced15f9093f49469b76860cc98e7a7a671 (patch)
tree98f2f5d71547608d25e154e26c630a72350c6c9e
parent07988744b347302925bc6cc66511e34224db55ab (diff)
Fixed #24114 -- Improved error message in GEOSGeometry constructor
-rw-r--r--django/contrib/gis/geos/geometry.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index 00094c93fe..c3ba634df1 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -71,8 +71,10 @@ class GEOSGeometry(GEOSBase, ListMixin):
elif hex_regex.match(geo_input):
# Handling HEXEWKB input.
g = wkb_r().read(force_bytes(geo_input))
- elif gdal.HAS_GDAL and json_regex.match(geo_input):
+ elif json_regex.match(geo_input):
# Handling GeoJSON input.
+ if not gdal.HAS_GDAL:
+ raise ValueError('Initializing geometry from JSON input requires GDAL.')
g = wkb_r().read(gdal.OGRGeometry(geo_input).wkb)
else:
raise ValueError('String or unicode input unrecognized as WKT EWKT, and HEXEWKB.')