summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/base.py
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2009-03-20 03:57:21 +0000
committerJustin Bronn <jbronn@gmail.com>2009-03-20 03:57:21 +0000
commit6e3b129f158cfb6de991854c36cdc44cd3434bb1 (patch)
treef57e3a94c1b0e9a4761bc6eb6fce381358c61084 /django/db/backends/sqlite3/base.py
parentfa89fdcd6b4a4ab4887740c0d0f4a73297a5b060 (diff)
Fixed #9628 -- Use `pysqlite2` for database backend, if installed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10105 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
-rw-r--r--django/db/backends/sqlite3/base.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index b0c087d1cd..b6263df7c7 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -3,7 +3,8 @@ SQLite3 backend for django.
Python 2.3 and 2.4 require pysqlite2 (http://pysqlite.org/).
-Python 2.5 and later use the sqlite3 module in the standard library.
+Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the
+standard library.
"""
from django.db.backends import *
@@ -14,18 +15,18 @@ from django.utils.safestring import SafeString
try:
try:
- from sqlite3 import dbapi2 as Database
- except ImportError, e1:
from pysqlite2 import dbapi2 as Database
+ except ImportError, e1:
+ from sqlite3 import dbapi2 as Database
except ImportError, exc:
import sys
from django.core.exceptions import ImproperlyConfigured
if sys.version_info < (2, 5, 0):
- module = 'pysqlite2'
- else:
- module = 'sqlite3'
+ module = 'pysqlite2 module'
exc = e1
- raise ImproperlyConfigured, "Error loading %s module: %s" % (module, exc)
+ else:
+ module = 'either pysqlite2 or sqlite3 modules (tried in that order)'
+ raise ImproperlyConfigured, "Error loading %s: %s" % (module, exc)
try:
import decimal