diff options
| author | Tim Graham <timograham@gmail.com> | 2017-01-25 10:16:10 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-25 10:16:10 -0500 |
| commit | 2d96c027f5eb32c2c09bd57df2240ae1d343b98e (patch) | |
| tree | 4a1b82b37cee1ffca7badb89cc553a557569c62b /django | |
| parent | 632c4ffd9cb1da273303bcd8005fff216506c795 (diff) | |
Refs #23919 -- Removed obsolete MySQLdb references.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/mysql/base.py | 23 | ||||
| -rw-r--r-- | django/db/backends/mysql/features.py | 6 |
2 files changed, 7 insertions, 22 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 76a4313a72..2f20b727ed 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -16,7 +16,7 @@ try: except ImportError as err: raise ImproperlyConfigured( 'Error loading MySQLdb module.\n' - 'Did you install mysqlclient or MySQL-python?' + 'Did you install mysqlclient?' ) from err from MySQLdb.constants import CLIENT, FIELD_TYPE # isort:skip @@ -31,18 +31,14 @@ 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, 3, 3): + raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__) -# 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. +# 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. django_conversions = conversions.copy() django_conversions.update({ FIELD_TYPE.TIME: backend_utils.typecast_time, @@ -53,13 +49,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: """ A thin wrapper around MySQLdb's normal cursor class so that we can catch diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index 412887793c..89cb2c00db 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -1,8 +1,6 @@ from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property -from .base import Database - class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () @@ -48,9 +46,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def supports_microsecond_precision(self): - # See https://github.com/farcepest/MySQLdb1/issues/24 for the reason - # about requiring MySQLdb 1.2.5 - return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5) + return self.connection.mysql_version >= (5, 6, 4) @cached_property def has_zoneinfo_database(self): |
