mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Refs #23919 -- Removed pysqlite support (it's Python 2 only).
This commit is contained in:
		| @@ -4,7 +4,7 @@ from ctypes.util import find_library | ||||
| from django.conf import settings | ||||
| from django.core.exceptions import ImproperlyConfigured | ||||
| from django.db.backends.sqlite3.base import ( | ||||
|     Database, DatabaseWrapper as SQLiteDatabaseWrapper, SQLiteCursorWrapper, | ||||
|     DatabaseWrapper as SQLiteDatabaseWrapper, SQLiteCursorWrapper, | ||||
| ) | ||||
| from django.utils import six | ||||
|  | ||||
| @@ -24,11 +24,6 @@ class DatabaseWrapper(SQLiteDatabaseWrapper): | ||||
|     ops_class = SpatiaLiteOperations | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         # Before we get too far, make sure pysqlite 2.5+ is installed. | ||||
|         if Database.version_info < (2, 5, 0): | ||||
|             raise ImproperlyConfigured('Only versions of pysqlite 2.5+ are ' | ||||
|                                        'compatible with SpatiaLite and GeoDjango.') | ||||
|  | ||||
|         # Trying to find the location of the SpatiaLite library. | ||||
|         # Here we are figuring out the path to the SpatiaLite library | ||||
|         # (`libspatialite`). If it's not in the system library path (e.g., it | ||||
| @@ -50,9 +45,9 @@ class DatabaseWrapper(SQLiteDatabaseWrapper): | ||||
|             conn.enable_load_extension(True) | ||||
|         except AttributeError: | ||||
|             raise ImproperlyConfigured( | ||||
|                 'The pysqlite library does not support C extension loading. ' | ||||
|                 'Both SQLite and pysqlite must be configured to allow ' | ||||
|                 'the loading of extensions to use SpatiaLite.') | ||||
|                 'SpatiaLite requires SQLite to be configured to allow ' | ||||
|                 'extension loading.' | ||||
|             ) | ||||
|         # Loading the SpatiaLite library extension on the connection, and returning | ||||
|         # the created cursor. | ||||
|         cur = conn.cursor(factory=SQLiteCursorWrapper) | ||||
|   | ||||
| @@ -1,12 +1,10 @@ | ||||
| """ | ||||
| SQLite3 backend for django. | ||||
|  | ||||
| Works with either the pysqlite2 module or the sqlite3 module in the | ||||
| standard library. | ||||
| SQLite3 backend for the sqlite3 module in the standard library. | ||||
| """ | ||||
| import decimal | ||||
| import re | ||||
| import warnings | ||||
| from sqlite3 import dbapi2 as Database | ||||
|  | ||||
| import pytz | ||||
|  | ||||
| @@ -20,15 +18,6 @@ from django.utils.dateparse import ( | ||||
| ) | ||||
| from django.utils.encoding import force_text | ||||
|  | ||||
| try: | ||||
|     try: | ||||
|         from pysqlite2 import dbapi2 as Database | ||||
|     except ImportError: | ||||
|         from sqlite3 import dbapi2 as Database | ||||
| except ImportError as exc: | ||||
|     raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc) | ||||
|  | ||||
| # Some of these import sqlite3, so import them after checking if it's installed. | ||||
| from .client import DatabaseClient                          # isort:skip | ||||
| from .creation import DatabaseCreation                      # isort:skip | ||||
| from .features import DatabaseFeatures                      # isort:skip | ||||
|   | ||||
		Reference in New Issue
	
	Block a user