From a488589461582d60a41326cd8a6ab28b96a9e19a Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Tue, 29 Dec 2009 10:18:56 +0000 Subject: [PATCH] Fixed #12344 -- Using `select_related()` on geographic fields with the Oracle spatial backend now works. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12022 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/db/models/sql/compiler.py | 4 ++-- django/contrib/gis/tests/relatedapp/tests.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/db/models/sql/compiler.py b/django/contrib/gis/db/models/sql/compiler.py index 1a91f8eeba..a94093fec3 100644 --- a/django/contrib/gis/db/models/sql/compiler.py +++ b/django/contrib/gis/db/models/sql/compiler.py @@ -191,8 +191,8 @@ class GeoSQLCompiler(compiler.SQLCompiler): if self.connection.ops.oracle or getattr(self.query, 'geo_values', False): # We resolve the rest of the columns if we're on Oracle or if # the `geo_values` attribute is defined. - for value, field in izip(row[index_start:], fields): - values.append(self.query.convert_values(value, field, self.connection)) + for value, field in map(None, row[index_start:], fields): + values.append(self.query.convert_values(value, field, connection=self.connection)) else: values.extend(row[index_start:]) return tuple(values) diff --git a/django/contrib/gis/tests/relatedapp/tests.py b/django/contrib/gis/tests/relatedapp/tests.py index 8ebe871e6d..184b65b9c7 100644 --- a/django/contrib/gis/tests/relatedapp/tests.py +++ b/django/contrib/gis/tests/relatedapp/tests.py @@ -19,7 +19,6 @@ class RelatedGeoModelTest(unittest.TestCase): loc = Location.objects.create(point=Point(lon, lat)) c = City.objects.create(name=name, state=state, location=loc) - @no_oracle # TODO: Fix select_related() problems w/Oracle and pagination. def test02_select_related(self): "Testing `select_related` on geographic models (see #7126)." qs1 = City.objects.all() @@ -34,7 +33,6 @@ class RelatedGeoModelTest(unittest.TestCase): self.assertEqual(Point(lon, lat), c.location.point) @no_mysql - @no_oracle # Pagination problem is implicated in this test as well. def test03_transform_related(self): "Testing the `transform` GeoQuerySet method on related geographic models." # All the transformations are to state plane coordinate systems using