Author: jbronn
Date: 2011-09-16 14:19:30 -0700 (Fri, 16 Sep 2011)
New Revision: 16843
Modified:
django/trunk/django/contrib/gis/geometry/regex.py
django/trunk/django/contrib/gis/geos/tests/test_geos.py
Log:
Fixed #16864 -- WKT regex now allows negative SRIDs. Thanks, Marcel Dancak for
bug report and initial patch.
Modified: django/trunk/django/contrib/gis/geometry/regex.py
===================================================================
--- django/trunk/django/contrib/gis/geometry/regex.py 2011-09-16 18:06:42 UTC
(rev 16842)
+++ django/trunk/django/contrib/gis/geometry/regex.py 2011-09-16 21:19:30 UTC
(rev 16843)
@@ -4,7 +4,7 @@
# 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,\.\-\(\) ]+)$',
Modified: django/trunk/django/contrib/gis/geos/tests/test_geos.py
===================================================================
--- django/trunk/django/contrib/gis/geos/tests/test_geos.py 2011-09-16
18:06:42 UTC (rev 16842)
+++ django/trunk/django/contrib/gis/geos/tests/test_geos.py 2011-09-16
21:19:30 UTC (rev 16843)
@@ -182,13 +182,14 @@
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)."
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.