Skip to content

Commit fbe841d

Browse files
committed
BUG20987205: Add support for Django 1.8
This patch makes Connector/Python compatible with Django 1.8. For more info on the changes in Django 1.8.1 backend API refer https://docs.djangoproject.com/en/1.8/releases/1.8/#database-backend-api With this patch we fix the following two bugs as well: BUG21054556: Attribute error raised with Django BUG21054559: Using a binary field in Django raises an exception
1 parent 03aa47e commit fbe841d

File tree

11 files changed

+793
-463
lines changed

11 files changed

+793
-463
lines changed

lib/mysql/connector/cursor.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,11 @@ def executemany(self, operation, seq_params):
598598
return None
599599
self._connection.handle_unread_result()
600600

601-
if not isinstance(seq_params, (list, tuple)):
601+
try:
602+
_ = iter(seq_params)
603+
except TypeError:
602604
raise errors.ProgrammingError(
603-
"Parameters for query must be list or tuple.")
605+
"Parameters for query must be an Iterable.")
604606

605607
# Optimize INSERTs by batching them
606608
if re.match(RE_SQL_INSERT_STMT, operation):
@@ -859,9 +861,11 @@ def statement(self):
859861
statements were executed, the current statement in the iterator
860862
will be returned.
861863
"""
864+
if self._executed is None:
865+
return None
862866
try:
863-
return self._executed.strip().decode('utf8')
864-
except AttributeError:
867+
return self._executed.strip().decode('utf-8')
868+
except (AttributeError, UnicodeDecodeError) as err:
865869
return self._executed.strip()
866870

867871
@property

0 commit comments

Comments
 (0)