Fix MySQLdb1-1 Exception format incompatible with previous versions

Unfortunately, when I broke this, I broke the test at the same time. That should have been a red flag.
This commit is contained in:
farcepest
2012-09-26 16:02:05 -04:00
committed by Andy Dustman
parent 162e9e4d84
commit 048b70d901
2 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ def defaulterrorhandler(connection, cursor, errorclass, errorvalue):
connection.messages.append(error) connection.messages.append(error)
del cursor del cursor
del connection del connection
raise errorclass(errorvalue) raise errorclass, errorvalue
re_numeric_part = re.compile(r"^(\d+)") re_numeric_part = re.compile(r"^(\d+)")

View File

@ -77,8 +77,8 @@ class test_MySQLdb(capabilities.DatabaseTest):
from MySQLdb.constants import ER from MySQLdb.constants import ER
try: try:
self.cursor.execute("describe some_non_existent_table"); self.cursor.execute("describe some_non_existent_table");
except self.connection.ProgrammingError as msg: except self.connection.ProgrammingError, msg:
self.assertTrue(msg.args[0].args[0] == ER.NO_SUCH_TABLE) self.assertTrue(msg[0] == ER.NO_SUCH_TABLE)
def test_bug_3514287(self): def test_bug_3514287(self):
c = self.cursor c = self.cursor