diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-09-25 01:53:34 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-09-25 01:53:34 +0000 |
| commit | b4e5a96ccc6aeb0cc4761865d3ea3221d3665e72 (patch) | |
| tree | 8a32d2c1c525c29aca09f3c53af98b6def4cffe1 | |
| parent | e2664759e6f3c6436f536d5193279472312d2c90 (diff) | |
Fixed #2772 -- Made SQLite support work correctly with Python 2.5 standard
module (as well as pysqlite2 for earlier Python versions). Patch from
ymasuda[at]ethercube.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index a3e8f0d584..3fe7eb43ac 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -4,10 +4,18 @@ SQLite3 backend for django. Requires pysqlite2 (http://pysqlite.org/). from django.db.backends import util try: - from pysqlite2 import dbapi2 as Database + try: + from sqlite3 import dbapi2 as Database + except ImportError: + from pysqlite2 import dbapi2 as Database except ImportError, e: + import sys from django.core.exceptions import ImproperlyConfigured - raise ImproperlyConfigured, "Error loading pysqlite2 module: %s" % e + if sys.version_info < (2, 5, 0): + module = 'pysqlite2' + else: + module = 'sqlite3' + raise ImproperlyConfigured, "Error loading %s module: %s" % (module, e) DatabaseError = Database.DatabaseError |
