diff options
| author | Tim Graham <timograham@gmail.com> | 2017-01-25 10:16:10 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-01-25 10:31:24 -0500 |
| commit | ec0af19f4c9c845ff1ce376c83853ae9345205ca (patch) | |
| tree | df2618f253d7812bc0c5381ad67c2ca87e79d94f /django | |
| parent | c94cb4f86541d8f76ee27652e214fedd0c0920fe (diff) | |
[1.11.x] Bumped MySQLdb version requirement to 1.2.3.
Older versions don't support Python 2.7.
Partial backport of 2d96c027f5eb32c2c09bd57df2240ae1d343b98e from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/mysql/base.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index d0487c5e30..06833236e7 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -42,13 +42,12 @@ from .operations import DatabaseOperations # isort:skip from .schema import DatabaseSchemaEditor # isort:skip from .validation import DatabaseValidation # isort:skip -# We want version (1, 2, 1, 'final', 2) or later. We can't just use -# lexicographic ordering in this check because then (1, 2, 1, 'gamma') -# inadvertently passes the version test. version = Database.version_info -if (version < (1, 2, 1) or ( - version[:3] == (1, 2, 1) and (len(version) < 5 or version[3] != 'final' or version[4] < 2))): - raise ImproperlyConfigured("MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__) +if version < (1, 2, 3): + raise ImproperlyConfigured( + "MySQLdb/mysqlclient 1.2.3 or newer is required; you have %s" + % Database.__version__ + ) def adapt_datetime_warn_on_aware_datetime(value, conv): @@ -65,11 +64,11 @@ def adapt_datetime_warn_on_aware_datetime(value, conv): return Thing2Literal(value.strftime("%Y-%m-%d %H:%M:%S.%f"), conv) -# MySQLdb-1.2.1 returns TIME columns as timedelta -- they are more like -# timedelta in terms of actual behavior as they are signed and include days -- -# and Django expects time, so we still need to override that. We also need to -# add special handling for SafeText and SafeBytes as MySQLdb's type -# checking is too tight to catch those (see Django ticket #6052). +# MySQLdb returns TIME columns as timedelta -- they are more like timedelta in +# terms of actual behavior as they are signed and include days -- and Django +# expects time, so we still need to override that. We also need to add special +# handling for SafeText and SafeBytes as MySQLdb's type checking is too tight +# to catch those (see Django ticket #6052). django_conversions = conversions.copy() django_conversions.update({ FIELD_TYPE.TIME: backend_utils.typecast_time, @@ -83,13 +82,6 @@ django_conversions.update({ server_version_re = re.compile(r'(\d{1,2})\.(\d{1,2})\.(\d{1,2})') -# MySQLdb-1.2.1 and newer automatically makes use of SHOW WARNINGS on -# MySQL-4.1 and newer, so the MysqlDebugWrapper is unnecessary. Since the -# point is to raise Warnings as exceptions, this can be done with the Python -# warning module, and this is setup when the connection is created, and the -# standard backend_utils.CursorDebugWrapper can be used. Also, using sql_mode -# TRADITIONAL will automatically cause most warnings to be treated as errors. - class CursorWrapper(object): """ A thin wrapper around MySQLdb's normal cursor class so that we can catch |
