web/lib/django/contrib/gis/db/backend/__init__.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/contrib/gis/db/backend/__init__.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/contrib/gis/db/backend/__init__.py	Tue May 25 02:43:45 2010 +0200
@@ -1,20 +1,11 @@
-"""
- This module provides the backend for spatial SQL construction with Django.
-
- Specifically, this module will import the correct routines and modules
- needed for GeoDjango to interface with the spatial database.
-"""
-from django.conf import settings
-from django.contrib.gis.db.backend.util import gqn
+from django.db import connection
 
-# Retrieving the necessary settings from the backend.
-if settings.DATABASE_ENGINE == 'postgresql_psycopg2':
-    from django.contrib.gis.db.backend.postgis import create_test_spatial_db, get_geo_where_clause, SpatialBackend
-elif settings.DATABASE_ENGINE == 'oracle':
-    from django.contrib.gis.db.backend.oracle import create_test_spatial_db, get_geo_where_clause, SpatialBackend
-elif settings.DATABASE_ENGINE == 'mysql':
-    from django.contrib.gis.db.backend.mysql import create_test_spatial_db, get_geo_where_clause, SpatialBackend
-elif settings.DATABASE_ENGINE == 'sqlite3':
-    from django.contrib.gis.db.backend.spatialite import create_test_spatial_db, get_geo_where_clause, SpatialBackend
-else:
-    raise NotImplementedError('No Geographic Backend exists for %s' % settings.DATABASE_ENGINE)
+if hasattr(connection.ops, 'spatial_version'):
+    from warnings import warn
+    warn('The `django.contrib.gis.db.backend` module was refactored and '
+         'renamed to `django.contrib.gis.db.backends` in 1.2.  '
+         'All functionality of `SpatialBackend` '
+         'has been moved to the `ops` attribute of the spatial database '
+         'backend.  A `SpatialBackend` alias is provided here for '
+         'backwards-compatibility, but will be removed in 1.3.')
+    SpatialBackend = connection.ops