[1.10.x] Fixed #26785 -- Made Oracle return None rather than empty string for empty geometries.
Backport of ea4665066b
from master
This commit is contained in:
parent
23ac35af19
commit
be1022d0e7
|
@ -79,6 +79,7 @@ class BaseSpatialField(Field):
|
||||||
of the spatial reference system of the field.
|
of the spatial reference system of the field.
|
||||||
"""
|
"""
|
||||||
description = _("The base GIS field.")
|
description = _("The base GIS field.")
|
||||||
|
empty_strings_allowed = False
|
||||||
# Geodetic units.
|
# Geodetic units.
|
||||||
geodetic_units = ('decimal degree', 'degree')
|
geodetic_units = ('decimal degree', 'degree')
|
||||||
|
|
||||||
|
|
|
@ -223,12 +223,9 @@ class GISFunctionsTests(TestCase):
|
||||||
geom = Point(5, 23, srid=4326)
|
geom = Point(5, 23, srid=4326)
|
||||||
qs = Country.objects.annotate(inter=functions.Intersection('mpoly', geom))
|
qs = Country.objects.annotate(inter=functions.Intersection('mpoly', geom))
|
||||||
for c in qs:
|
for c in qs:
|
||||||
if spatialite or mysql:
|
if spatialite or mysql or oracle:
|
||||||
# When the intersection is empty, Spatialite and MySQL return None
|
# When the intersection is empty, some databases return None.
|
||||||
expected = None
|
expected = None
|
||||||
elif oracle:
|
|
||||||
# When the intersection is empty, Oracle returns an empty string
|
|
||||||
expected = ''
|
|
||||||
else:
|
else:
|
||||||
expected = c.mpoly.intersection(geom)
|
expected = c.mpoly.intersection(geom)
|
||||||
self.assertEqual(c.inter, expected)
|
self.assertEqual(c.inter, expected)
|
||||||
|
|
Loading…
Reference in New Issue