From 6f43b2b8a55d72d1e8e04163ff0c2091cf6b8ce5 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Wed, 30 Nov 2016 21:56:09 +0600 Subject: [PATCH] Removed unneeded GeoAggregate.convert_value() & DatabaseOperations.convert_geom(). --- django/contrib/gis/db/backends/base/operations.py | 3 --- django/contrib/gis/db/backends/oracle/operations.py | 9 --------- django/contrib/gis/db/backends/postgis/operations.py | 10 ---------- .../contrib/gis/db/backends/spatialite/operations.py | 9 --------- django/contrib/gis/db/models/aggregates.py | 3 --- 5 files changed, 34 deletions(-) diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py index 8fc51da84a..436a703e3e 100644 --- a/django/contrib/gis/db/backends/base/operations.py +++ b/django/contrib/gis/db/backends/base/operations.py @@ -83,9 +83,6 @@ class BaseSpatialOperations(object): def convert_extent3d(self, box, srid): raise NotImplementedError('Aggregate 3D extent not implemented for this spatial backend.') - def convert_geom(self, geom_val, geom_field): - raise NotImplementedError('Aggregate method not implemented for this spatial backend.') - # For quoting column values, rather than columns. def geo_quote_name(self, name): return "'%s'" % name diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index a6a0f464c9..639634e8e3 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -16,7 +16,6 @@ from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.models import aggregates from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Distance -from django.db.backends.oracle.base import Database from django.db.backends.oracle.operations import DatabaseOperations from django.utils import six @@ -180,14 +179,6 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations): else: return None - def convert_geom(self, value, geo_field): - if value: - if isinstance(value, Database.LOB): - value = value.read() - return Geometry(value, geo_field.srid) - else: - return None - def geo_db_type(self, f): """ Returns the geometry database type for Oracle. Unlike other spatial diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index 56bdbd6824..ae0821694a 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -5,7 +5,6 @@ from django.contrib.gis.db.backends.base.operations import \ BaseSpatialOperations from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.gdal import GDALRaster -from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Distance from django.core.exceptions import ImproperlyConfigured from django.db.backends.postgresql.operations import DatabaseOperations @@ -266,15 +265,6 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): xmax, ymax, zmax = map(float, ur.split()) return (xmin, ymin, zmin, xmax, ymax, zmax) - def convert_geom(self, hex, geo_field): - """ - Converts the geometry returned from PostGIS aggregates. - """ - if hex: - return Geometry(hex, srid=geo_field.srid) - else: - return None - def geo_db_type(self, f): """ Return the database field type for the given spatial field. diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index 693dea9fe5..73274a2fba 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -130,15 +130,6 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): xmax, ymax = shell[2][:2] return (xmin, ymin, xmax, ymax) - def convert_geom(self, wkt, geo_field): - """ - Converts geometry WKT returned from a SpatiaLite aggregate. - """ - if wkt: - return Geometry(wkt, geo_field.srid) - else: - return None - def geo_db_type(self, f): """ Returns None because geometry columns are added via the diff --git a/django/contrib/gis/db/models/aggregates.py b/django/contrib/gis/db/models/aggregates.py index bdcd05aa0e..416481f9ca 100644 --- a/django/contrib/gis/db/models/aggregates.py +++ b/django/contrib/gis/db/models/aggregates.py @@ -30,9 +30,6 @@ class GeoAggregate(Aggregate): raise ValueError('Geospatial aggregates only allowed on geometry fields.') return c - def convert_value(self, value, expression, connection, context): - return connection.ops.convert_geom(value, self.output_field) - class Collect(GeoAggregate): name = 'Collect'