Skip to content

Commit

Permalink
Fixed #9628 -- Use pysqlite2 for database backend, if installed.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10105 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jbronn committed Mar 20, 2009
1 parent fa89fdc commit 6e3b129
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions django/db/backends/sqlite3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
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 *
Expand All @@ -14,18 +15,18 @@

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
Expand Down

0 comments on commit 6e3b129

Please sign in to comment.