summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorNicolas NoƩ <nicolas@niconoe.eu>2016-04-19 11:35:50 +0200
committerTim Graham <timograham@gmail.com>2016-04-19 11:19:44 -0400
commit23fbd3ff48a90b7e5d373b6fe50b65d1c48dabed (patch)
tree782ebe12ebe38a99a27e4b54fa747860f3fdd009 /django
parent5402f3ab09413a571fd9d3aa27f6c76ec42ff891 (diff)
Fixed #26512 -- Added tests for SpatialRefSysMixin.get_units().
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/db/backends/base/models.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/django/contrib/gis/db/backends/base/models.py b/django/contrib/gis/db/backends/base/models.py
index 6bebfa9f7e..85f4478534 100644
--- a/django/contrib/gis/db/backends/base/models.py
+++ b/django/contrib/gis/db/backends/base/models.py
@@ -164,15 +164,14 @@ class SpatialRefSysMixin(object):
@classmethod
def get_units(cls, wkt):
"""
- Class method used by GeometryField on initialization to
- retrieve the units on the given WKT, without having to use
- any of the database fields.
+ Return a tuple of (unit_value, unit_name) for the given WKT without
+ using any of the database fields.
"""
if gdal.HAS_GDAL:
return gdal.SpatialReference(wkt).units
else:
m = cls.units_regex.match(wkt)
- return m.group('unit'), m.group('unit_name')
+ return float(m.group('unit')), m.group('unit_name')
@classmethod
def get_spheroid(cls, wkt, string=True):