Author: phd
Date: 2007-09-26 15:19:34 -0600 (Wed, 26 Sep 2007)
New Revision: 3003
Modified:
SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py
Log:
Backported the patch from r2986 from the trunk.
Modified: SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py 2007-09-26 21:18:52 UTC (rev 3002)
+++ SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py 2007-09-26 21:19:34 UTC (rev 3003)
@@ -89,7 +89,10 @@
# For MySQLdb 1.2.1 and later, we go
# encoding->unicode->charset (in the mysql db)
if self.need_unicode and not isinstance(query, unicode):
- query = unicode(query, self.encoding)
+ try:
+ query = unicode(query, self.encoding)
+ except UnicodeError:
+ pass
return cursor.execute(query)
except MySQLdb.OperationalError, e:
if e.args[0] == 2013: # SERVER_LOST error
|