From 5b95d421f7ab8deadaf3c1ad3f341bdfc85bfca4 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 23 Jan 2017 10:36:48 -0500 Subject: [PATCH] Refs #23919 -- Removed a MySQLdb workaround (refs #6052) for Python 2. --- django/db/backends/mysql/base.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 60cf4b9df5..76a4313a72 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -10,7 +10,6 @@ from django.db import utils from django.db.backends import utils as backend_utils from django.db.backends.base.base import BaseDatabaseWrapper from django.utils.functional import cached_property -from django.utils.safestring import SafeBytes, SafeText try: import MySQLdb as Database @@ -43,9 +42,7 @@ if (version < (1, 2, 1) or ( # 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). +# and Django expects time. django_conversions = conversions.copy() django_conversions.update({ FIELD_TYPE.TIME: backend_utils.typecast_time, @@ -249,10 +246,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): return kwargs def get_new_connection(self, conn_params): - conn = Database.connect(**conn_params) - conn.encoders[SafeText] = conn.encoders[str] - conn.encoders[SafeBytes] = conn.encoders[bytes] - return conn + return Database.connect(**conn_params) def init_connection_state(self): assignments = []