From 89ded975fe1ff75b5b2456f4ee7e1256a261108e Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Mon, 4 Jan 2010 02:37:46 +0000 Subject: [PATCH] Fixed #12479 -- Pass in connection argument to `as_sql` in `GeoSQLCompiler.get_columns`. Thanks, jpwatts, for bug report and initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12083 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/db/models/sql/compiler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/contrib/gis/db/models/sql/compiler.py b/django/contrib/gis/db/models/sql/compiler.py index a94093fec3..78eeeafe19 100644 --- a/django/contrib/gis/db/models/sql/compiler.py +++ b/django/contrib/gis/db/models/sql/compiler.py @@ -55,8 +55,8 @@ class GeoSQLCompiler(compiler.SQLCompiler): aliases.add(r) col_aliases.add(col[1]) else: - result.append(col.as_sql(qn=qn)) - + result.append(col.as_sql(qn, self.connection)) + if hasattr(col, 'alias'): aliases.add(col.alias) col_aliases.add(col.alias) @@ -70,7 +70,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): max_name_length = self.connection.ops.max_name_length() result.extend([ '%s%s' % ( - self.get_extra_select_format(alias) % aggregate.as_sql(qn=qn, connection=self.connection), + self.get_extra_select_format(alias) % aggregate.as_sql(qn, self.connection), alias is not None and ' AS %s' % qn(truncate_name(alias, max_name_length)) or ''