summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2016-06-21 14:08:29 +0500
committerTim Graham <timograham@gmail.com>2016-06-21 18:51:08 -0400
commitbe1022d0e771b6f7e60edc3aec596de04608996f (patch)
tree6ccebceee4419e4113b4aec29385e090b1bde18e
parent23ac35af19face4ad0b466f5aaffafd5db98db0e (diff)
[1.10.x] Fixed #26785 -- Made Oracle return None rather than empty string for empty geometries.
Backport of ea4665066b651e0e2730f2e2d85fcef9d7ac7966 from master
-rw-r--r--django/contrib/gis/db/models/fields.py1
-rw-r--r--tests/gis_tests/geoapp/test_functions.py7
2 files changed, 3 insertions, 5 deletions
diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py
index 1621fe4c48..c1aedd813c 100644
--- a/django/contrib/gis/db/models/fields.py
+++ b/django/contrib/gis/db/models/fields.py
@@ -79,6 +79,7 @@ class BaseSpatialField(Field):
of the spatial reference system of the field.
"""
description = _("The base GIS field.")
+ empty_strings_allowed = False
# Geodetic units.
geodetic_units = ('decimal degree', 'degree')
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index a9bf319a05..3d42a4e407 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -223,12 +223,9 @@ class GISFunctionsTests(TestCase):
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(inter=functions.Intersection('mpoly', geom))
for c in qs:
- if spatialite or mysql:
- # When the intersection is empty, Spatialite and MySQL return None
+ if spatialite or mysql or oracle:
+ # When the intersection is empty, some databases return None.
expected = None
- elif oracle:
- # When the intersection is empty, Oracle returns an empty string
- expected = ''
else:
expected = c.mpoly.intersection(geom)
self.assertEqual(c.inter, expected)