From d25a599dca9b7644b238f6c89a66545dfdabe393 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 3 Oct 2012 13:32:26 +0200 Subject: [PATCH] Fixed #19063 -- Fixed version parameter of gml GeoQuerySet method Thanks lmisek@go2.pl for the report. --- django/contrib/gis/db/models/query.py | 4 ++-- django/contrib/gis/tests/geoapp/tests.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py index b994252002..2a8de4cde3 100644 --- a/django/contrib/gis/db/models/query.py +++ b/django/contrib/gis/db/models/query.py @@ -194,9 +194,9 @@ class GeoQuerySet(QuerySet): # PostGIS AsGML() aggregate function parameter order depends on the # version -- uggh. if backend.spatial_version > (1, 3, 1): - procedure_fmt = '%(version)s,%(geo_col)s,%(precision)s' + s['procedure_fmt'] = '%(version)s,%(geo_col)s,%(precision)s' else: - procedure_fmt = '%(geo_col)s,%(precision)s,%(version)s' + s['procedure_fmt'] = '%(geo_col)s,%(precision)s,%(version)s' s['procedure_args'] = {'precision' : precision, 'version' : version} return self._spatial_attribute('gml', s, **kwargs) diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 952ac9d45b..7d8121425a 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -529,6 +529,9 @@ class GeoQuerySetTest(TestCase): for ptown in [ptown1, ptown2]: self.assertTrue(gml_regex.match(ptown.gml)) + if postgis: + self.assertIn('', City.objects.gml(version=3).get(name='Pueblo').gml) + def test_kml(self): "Testing KML output from the database using GeoQuerySet.kml()." # Only PostGIS and Spatialite (>=2.4.0-RC4) support KML serialization