summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/gaerdbms.py
diff options
context:
space:
mode:
authorDan Ring <dfring@gmail.com>2013-04-19 18:01:39 -0700
committerDan Ring <dfring@gmail.com>2013-04-19 18:01:39 -0700
commitd657cf0600e9fa1aa49a4e27ba2063073d879987 (patch)
treefd4dd7950eea6d7f44e3b51c9ced975d193db851 /lib/sqlalchemy/dialects/mysql/gaerdbms.py
parentb6bf8c2a3001c38684ef806678dd187926e1910b (diff)
downloadsqlalchemy-d657cf0600e9fa1aa49a4e27ba2063073d879987.tar.gz
Fix mysql+gaerdbms dialect for changed exception format
googleappengine v1.7.5 changed the exception format to be incompatible with MySQLDialect_gaerdbms#_extract_error_code This fix works for both old- and new-style exceptions. Changes causing the breakage: /trunk/python/google/storage/speckle/python/api/rdbms.py at https://code.google.com/p/googleappengine/source/detail?r=318
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/gaerdbms.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/gaerdbms.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/gaerdbms.py b/lib/sqlalchemy/dialects/mysql/gaerdbms.py
index a93a78b73..ad0ce7638 100644
--- a/lib/sqlalchemy/dialects/mysql/gaerdbms.py
+++ b/lib/sqlalchemy/dialects/mysql/gaerdbms.py
@@ -65,10 +65,10 @@ class MySQLDialect_gaerdbms(MySQLDialect_mysqldb):
return [], opts
def _extract_error_code(self, exception):
- match = re.compile(r"^(\d+):").match(str(exception))
+ match = re.compile(r"^(\d+):|^\((\d+),").match(str(exception))
# The rdbms api will wrap then re-raise some types of errors
# making this regex return no matches.
- code = match.group(1) if match else None
+ code = match.group(1) or match.group(2) if match else None
if code:
return int(code)