Ticket #9628: 9628-r9791-optionD.diff

File 9628-r9791-optionD.diff, 1.2 KB (added by Ramiro Morales, 15 years ago)

Patch implementing strategy D as per django-dev thread

  • django/db/backends/sqlite3/base.py

    diff -r fa344eb7dd92 django/db/backends/sqlite3/base.py
    a b  
    33
    44Python 2.3 and 2.4 require pysqlite2 (http://pysqlite.org/).
    55
    6 Python 2.5 and later use the sqlite3 module in the standard library.
     6Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the
     7standard library.
    78"""
    89
    910from django.db.backends import *
     
    1415
    1516try:
    1617    try:
     18        from pysqlite2 import dbapi2 as Database
     19    except ImportError, e1:
    1720        from sqlite3 import dbapi2 as Database
    18     except ImportError, e1:
    19         from pysqlite2 import dbapi2 as Database
    2021except ImportError, exc:
    2122    import sys
    2223    from django.core.exceptions import ImproperlyConfigured
    2324    if sys.version_info < (2, 5, 0):
    24         module = 'pysqlite2'
     25        module = 'pysqlite2 module'
     26        exc = e1
    2527    else:
    26         module = 'sqlite3'
    27         exc = e1
    28     raise ImproperlyConfigured, "Error loading %s module: %s" % (module, exc)
     28        module = 'either pysqlite2 or sqlite3 modules (tried in that order)'
     29    raise ImproperlyConfigured, "Error loading %s: %s" % (module, exc)
    2930
    3031try:
    3132    import decimal
Back to Top