Permalink
Browse files

Fixed GIS testsuite.

Moved HAS_SPATIALREFSYS back into the tests namespace since it only operates
on the default database and isn't a global flag like HAS_GDAL.
  • Loading branch information...
apollo13 committed Jun 17, 2012
1 parent d708298 commit ac1b9ae6301e2c38af7951f1feb56dafc380d3e7
@@ -44,18 +44,6 @@
except:
HAS_GDAL, GEOJSON = False, False
-from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite
-HAS_SPATIALREFSYS = True
-if oracle:
- from django.contrib.gis.db.backends.oracle.models import SpatialRefSys
-elif postgis:
- from django.contrib.gis.db.backends.postgis.models import SpatialRefSys
-elif spatialite:
- from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys
-else:
- HAS_SPATIALREFSYS = False
- SpatialRefSys = None
-
try:
from django.contrib.gis.gdal.envelope import Envelope
except ImportError:
@@ -1,5 +1,6 @@
from django.forms import ValidationError
-from django.contrib.gis.gdal import HAS_GDAL, HAS_SPATIALREFSYS
+from django.contrib.gis.gdal import HAS_GDAL
+from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS
from django.utils import unittest
@@ -1,6 +1,7 @@
from django.db import connection
-from django.contrib.gis.gdal import HAS_GDAL, HAS_SPATIALREFSYS, SpatialRefSys
-from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite
+from django.contrib.gis.gdal import HAS_GDAL
+from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis,
+ spatialite, HAS_SPATIALREFSYS, SpatialRefSys)
from django.utils import unittest
@@ -24,3 +24,14 @@ def no_spatialite(func): return no_backend(func, 'spatialite')
postgis = _default_db == 'postgis'
mysql = _default_db == 'mysql'
spatialite = _default_db == 'spatialite'
+
+HAS_SPATIALREFSYS = True
+if oracle:
+ from django.contrib.gis.db.backends.oracle.models import SpatialRefSys
+elif postgis:
+ from django.contrib.gis.db.backends.postgis.models import SpatialRefSys
+elif spatialite:
+ from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys
+else:
+ HAS_SPATIALREFSYS = False
+ SpatialRefSys = None

0 comments on commit ac1b9ae

Please sign in to comment.