Mercurial > p > roundup > code
diff roundup/backends/back_mysql.py @ 5248:198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Many raise statements near these are also fixed.
So are two ivorrect file encoding marks ('utf8'->'utf-8').
| author | Eric S. Raymond <esr@thyrsus.com> |
|---|---|
| date | Thu, 24 Aug 2017 22:21:37 -0400 |
| parents | e74c3611b138 |
| children | 62de601bdf6f |
line wrap: on
line diff
--- a/roundup/backends/back_mysql.py Thu Aug 24 17:55:02 2017 -0400 +++ b/roundup/backends/back_mysql.py Thu Aug 24 22:21:37 2017 -0400 @@ -161,8 +161,8 @@ self.log_info('open database %r'%(kwargs['db'],)) try: conn = MySQLdb.connect(**kwargs) - except MySQLdb.OperationalError, message: - raise hyperdb.DatabaseError, message + except MySQLdb.OperationalError as message: + raise hyperdb.DatabaseError(message) cursor = conn.cursor() cursor.execute("SET AUTOCOMMIT=0") lvl = isolation_levels [self.config.RDBMS_ISOLATION_LEVEL] @@ -179,10 +179,10 @@ try: self.load_dbschema() - except MySQLdb.OperationalError, message: + except MySQLdb.OperationalError as message: if message[0] != ER.NO_DB_ERROR: raise - except MySQLdb.ProgrammingError, message: + except MySQLdb.ProgrammingError as message: if message[0] != ER.NO_SUCH_TABLE: raise hyperdb.DatabaseError, message self.init_dbschema() @@ -583,7 +583,7 @@ self.log_info('close') try: self.conn.close() - except MySQLdb.ProgrammingError, message: + except MySQLdb.ProgrammingError as message: if str(message) != 'closing a closed connection': raise @@ -604,14 +604,14 @@ def create_inner(self, **propvalues): try: return rdbms_common.Class.create_inner(self, **propvalues) - except MySQLdb.IntegrityError, e: + except MySQLdb.IntegrityError as e: self._handle_integrity_error(e, propvalues) def set_inner(self, nodeid, **propvalues): try: return rdbms_common.Class.set_inner(self, nodeid, **propvalues) - except MySQLdb.IntegrityError, e: + except MySQLdb.IntegrityError as e: self._handle_integrity_error(e, propvalues) def _handle_integrity_error(self, e, propvalues):
