summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Broum <midlis+macbook@gmail.com>2015-05-03 18:41:34 +0100
committerTim Graham <timograham@gmail.com>2015-05-04 12:59:59 -0400
commit95058606c89ba2dc95205487fa837ec39cf41ed5 (patch)
tree3c333f2f4c76f3de62f81c709dfafde875214db4
parent17b1f7886c276086bbb471c0d5c3b510319f8bbb (diff)
Allowed using the sqlite3 backend as much as possible without _sqlite3.
The inner import was dropped during the reorganizing of the database backends in commit 28308078f397d1de36fd0da417ac7da2544ba12d.
-rw-r--r--django/db/backends/sqlite3/schema.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
index 5ce7a964e6..51c58a0330 100644
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -1,4 +1,3 @@
-import _sqlite3 # isort:skip
import codecs
import contextlib
import copy
@@ -34,6 +33,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
c.execute('PRAGMA foreign_keys = %s' % int(self._initial_pragma_fk))
def quote_value(self, value):
+ # The backend "mostly works" without this function and there are use
+ # cases for compiling Python without the sqlite3 libraries (e.g.
+ # security hardening).
+ import _sqlite3
try:
value = _sqlite3.adapt(value)
except _sqlite3.ProgrammingError: