summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/gis/geometry/regex.py2
-rw-r--r--django/contrib/gis/geos/tests/test_geos.py15
2 files changed, 9 insertions, 8 deletions
diff --git a/django/contrib/gis/geometry/regex.py b/django/contrib/gis/geometry/regex.py
index 1b9e2f46f4..22d16cb4c8 100644
--- a/django/contrib/gis/geometry/regex.py
+++ b/django/contrib/gis/geometry/regex.py
@@ -4,7 +4,7 @@ import re
# to prevent potentially malicious input from reaching the underlying C
# library. Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
-wkt_regex = re.compile(r'^(SRID=(?P<srid>\d+);)?'
+wkt_regex = re.compile(r'^(SRID=(?P<srid>\-?\d+);)?'
r'(?P<wkt>'
r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'
r'[ACEGIMLONPSRUTYZ\d,\.\-\(\) ]+)$',
diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py
index f611dd4d1a..eb13a62cb9 100644
--- a/django/contrib/gis/geos/tests/test_geos.py
+++ b/django/contrib/gis/geos/tests/test_geos.py
@@ -182,13 +182,14 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
def test01h_ewkt(self):
"Testing EWKT."
- srid = 32140
- for p in self.geometries.polygons:
- ewkt = 'SRID=%d;%s' % (srid, p.wkt)
- poly = fromstr(ewkt)
- self.assertEqual(srid, poly.srid)
- self.assertEqual(srid, poly.shell.srid)
- self.assertEqual(srid, fromstr(poly.ewkt).srid) # Checking export
+ srids = (-1, 32140)
+ for srid in srids:
+ for p in self.geometries.polygons:
+ ewkt = 'SRID=%d;%s' % (srid, p.wkt)
+ poly = fromstr(ewkt)
+ self.assertEqual(srid, poly.srid)
+ self.assertEqual(srid, poly.shell.srid)
+ self.assertEqual(srid, fromstr(poly.ewkt).srid) # Checking export
def test01i_json(self):
"Testing GeoJSON input/output (via GDAL)."