Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #17278 -- Enabled the spatialite GIS tests to run without havin…

…g to specify a database name in the settings. Thanks to Aymeric for the report and to Ramiro for the initial patch.
  • Loading branch information...
commit 675431dfaaa7fc9fbd89be2602332287489ee04f 1 parent cccbb6b
Julien Phalip authored August 19, 2012
1  django/contrib/gis/db/backends/spatialite/creation.py
@@ -30,6 +30,7 @@ def create_test_db(self, verbosity=1, autoclobber=False):
30 30
 
31 31
         self.connection.close()
32 32
         self.connection.settings_dict["NAME"] = test_database_name
  33
+        self.connection.ops.confirm_spatial_components_versions()
33 34
 
34 35
         # Need to load the SpatiaLite initialization SQL before running `syncdb`.
35 36
         self.load_spatialite_sql()
11  django/contrib/gis/db/backends/spatialite/operations.py
@@ -113,6 +113,12 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
113 113
     def __init__(self, connection):
114 114
         super(DatabaseOperations, self).__init__(connection)
115 115
 
  116
+        # Creating the GIS terms dictionary.
  117
+        gis_terms = ['isnull']
  118
+        gis_terms += self.geometry_functions.keys()
  119
+        self.gis_terms = dict([(term, None) for term in gis_terms])
  120
+
  121
+    def confirm_spatial_components_versions(self):
116 122
         # Determine the version of the SpatiaLite library.
117 123
         try:
118 124
             vtup = self.spatialite_version_tuple()
@@ -129,11 +135,6 @@ def __init__(self, connection):
129 135
                                        'SQL loaded on this database?' %
130 136
                                        (self.connection.settings_dict['NAME'], msg))
131 137
 
132  
-        # Creating the GIS terms dictionary.
133  
-        gis_terms = ['isnull']
134  
-        gis_terms += list(self.geometry_functions)
135  
-        self.gis_terms = dict([(term, None) for term in gis_terms])
136  
-
137 138
         if version >= (2, 4, 0):
138 139
             # Spatialite 2.4.0-RC4 added AsGML and AsKML, however both
139 140
             # RC2 (shipped in popular Debian/Ubuntu packages) and RC4

0 notes on commit 675431d

Please sign in to comment.
Something went wrong with that request. Please try again.