Django

Code

Changeset 4751

Show
Ignore:
Timestamp:
03/18/07 14:16:47 (1 year ago)
Author:
mtredinnick
Message:

Fixed #3747 -- Added a stricter MySQLdb version check so that (1, 2, 1,
'final', 2) passes and (1, 2, 1, 'gamma') does not. Also fixed a problem in the
error reporting when the check fails.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/backends/mysql/base.py

    r4724 r4751  
    1111    from django.core.exceptions import ImproperlyConfigured 
    1212    raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e 
    13 if Database.version_info < (1,2,1,'final',2): 
    14     raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % MySQLdb.__version__ 
     13 
     14# We want version (1, 2, 1, 'final', 2) or later. We can't just use 
     15# lexicographic ordering in this check because then (1, 2, 1, 'gamma') 
     16# inadvertently passes the version test. 
     17version = Database.version_info 
     18if (version < (1,2,1) or (version[:3] == (1, 2, 1) and  
     19        (len(version) < 5 or version[3] != 'final' or version[4] < 2))): 
     20    raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__ 
    1521 
    1622from MySQLdb.converters import conversions