Ticket #9628: use-pysqlite2-if-newer.diff
File use-pysqlite2-if-newer.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/db/backends/sqlite3/base.py
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 use the sqlite3 module in the standard library, 7 unless a newer version of pysqlite2 is installed. 7 8 """ 8 9 9 10 from django.db.backends import * … … 11 12 from django.db.backends.sqlite3.creation import DatabaseCreation 12 13 from django.db.backends.sqlite3.introspection import DatabaseIntrospection 13 14 14 try: 15 Database = None 16 for pkg in ['sqlite3','pysqlite2']: 15 17 try: 16 from sqlite3 import dbapi2 as Database 17 except ImportError, e1: 18 from pysqlite2 import dbapi2 as Database 19 except ImportError, exc: 18 mod = __import__(pkg, {}, {}, ['dbapi2']) 19 if not Database or mod.dbapi2.version_info > Database.version_info: 20 Database = mod.dbapi2 21 except ImportError: 22 pass 23 if not Database: 20 24 import sys 21 25 from django.core.exceptions import ImproperlyConfigured 22 26 if sys.version_info < (2, 5, 0):