Removed some pre-1.3.0 postgis compatibility code

This commit is contained in:
Claude Paroz 2012-08-03 11:26:47 +02:00
parent 083a3a4e39
commit 2407c45c18
1 changed files with 9 additions and 28 deletions

View File

@ -163,7 +163,9 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
'contains' : PostGISFunction(prefix, 'Contains'), 'contains' : PostGISFunction(prefix, 'Contains'),
'intersects' : PostGISFunction(prefix, 'Intersects'), 'intersects' : PostGISFunction(prefix, 'Intersects'),
'relate' : (PostGISRelate, six.string_types), 'relate' : (PostGISRelate, six.string_types),
} 'coveredby' : PostGISFunction(prefix, 'CoveredBy'),
'covers' : PostGISFunction(prefix, 'Covers'),
}
# Valid distance types and substitutions # Valid distance types and substitutions
dtypes = (Decimal, Distance, float) + six.integer_types dtypes = (Decimal, Distance, float) + six.integer_types
@ -178,33 +180,12 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
'distance_gte' : (get_dist_ops('>='), dtypes), 'distance_gte' : (get_dist_ops('>='), dtypes),
'distance_lt' : (get_dist_ops('<'), dtypes), 'distance_lt' : (get_dist_ops('<'), dtypes),
'distance_lte' : (get_dist_ops('<='), dtypes), 'distance_lte' : (get_dist_ops('<='), dtypes),
} 'dwithin' : (PostGISFunctionParam(prefix, 'DWithin'), dtypes)
}
# Versions 1.2.2+ have KML serialization support.
if version < (1, 2, 2):
ASKML = False
else:
ASKML = 'ST_AsKML'
self.geometry_functions.update(
{'coveredby' : PostGISFunction(prefix, 'CoveredBy'),
'covers' : PostGISFunction(prefix, 'Covers'),
})
self.distance_functions['dwithin'] = (PostGISFunctionParam(prefix, 'DWithin'), dtypes)
# Adding the distance functions to the geometries lookup. # Adding the distance functions to the geometries lookup.
self.geometry_functions.update(self.distance_functions) self.geometry_functions.update(self.distance_functions)
# The union aggregate and topology operation use the same signature
# in versions 1.3+.
if version < (1, 3, 0):
UNIONAGG = 'GeomUnion'
UNION = 'Union'
MAKELINE = False
else:
UNIONAGG = 'ST_Union'
UNION = 'ST_Union'
MAKELINE = 'ST_MakeLine'
# Only PostGIS versions 1.3.4+ have GeoJSON serialization support. # Only PostGIS versions 1.3.4+ have GeoJSON serialization support.
if version < (1, 3, 4): if version < (1, 3, 4):
GEOJSON = False GEOJSON = False
@ -256,11 +237,11 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
self.geojson = GEOJSON self.geojson = GEOJSON
self.gml = prefix + 'AsGML' self.gml = prefix + 'AsGML'
self.intersection = prefix + 'Intersection' self.intersection = prefix + 'Intersection'
self.kml = ASKML self.kml = prefix + 'AsKML'
self.length = prefix + 'Length' self.length = prefix + 'Length'
self.length3d = prefix + 'Length3D' self.length3d = prefix + 'Length3D'
self.length_spheroid = prefix + 'length_spheroid' self.length_spheroid = prefix + 'length_spheroid'
self.makeline = MAKELINE self.makeline = prefix + 'MakeLine'
self.mem_size = prefix + 'mem_size' self.mem_size = prefix + 'mem_size'
self.num_geom = prefix + 'NumGeometries' self.num_geom = prefix + 'NumGeometries'
self.num_points =prefix + 'npoints' self.num_points =prefix + 'npoints'
@ -275,8 +256,8 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
self.sym_difference = prefix + 'SymDifference' self.sym_difference = prefix + 'SymDifference'
self.transform = prefix + 'Transform' self.transform = prefix + 'Transform'
self.translate = prefix + 'Translate' self.translate = prefix + 'Translate'
self.union = UNION self.union = prefix + 'Union'
self.unionagg = UNIONAGG self.unionagg = prefix + 'Union'
def check_aggregate_support(self, aggregate): def check_aggregate_support(self, aggregate):
""" """