Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 6e3b129f158cfb6de991854c36cdc44cd3434bb1 1 parent fa89fdc
Justin Bronn authored

Showing 1 changed file with 8 additions and 7 deletions. Show diff stats Hide diff stats

  1. 15  django/db/backends/sqlite3/base.py
15  django/db/backends/sqlite3/base.py
@@ -3,7 +3,8 @@
3 3
 
4 4
 Python 2.3 and 2.4 require pysqlite2 (http://pysqlite.org/).
5 5
 
6  
-Python 2.5 and later use the sqlite3 module in the standard library.
  6
+Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the
  7
+standard library.
7 8
 """
8 9
 
9 10
 from django.db.backends import *
@@ -14,18 +15,18 @@
14 15
 
15 16
 try:
16 17
     try:
17  
-        from sqlite3 import dbapi2 as Database
18  
-    except ImportError, e1:
19 18
         from pysqlite2 import dbapi2 as Database
  19
+    except ImportError, e1:
  20
+        from sqlite3 import dbapi2 as Database
20 21
 except ImportError, exc:
21 22
     import sys
22 23
     from django.core.exceptions import ImproperlyConfigured
23 24
     if sys.version_info < (2, 5, 0):
24  
-        module = 'pysqlite2'
25  
-    else:
26  
-        module = 'sqlite3'
  25
+        module = 'pysqlite2 module'
27 26
         exc = e1
28  
-    raise ImproperlyConfigured, "Error loading %s module: %s" % (module, exc)
  27
+    else:
  28
+        module = 'either pysqlite2 or sqlite3 modules (tried in that order)'
  29
+    raise ImproperlyConfigured, "Error loading %s: %s" % (module, exc)
29 30
 
30 31
 try:
31 32
     import decimal

0 notes on commit 6e3b129

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