Skip to content

Commit 28f64e3

Browse files
committed
Merge pull request django-commons#291 from valsteen/master
prevent crash due to SQLDebugPanel when transaction is in error state
2 parents aeb45f2 + 7069885 commit 28f64e3

File tree

1 file changed

+2
-1
lines changed
  • debug_toolbar/utils/tracking

1 file changed

+2
-1
lines changed

debug_toolbar/utils/tracking/db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ def execute(self, sql, params=()):
146146
}
147147

148148
if engine == 'psycopg2':
149+
from psycopg2.extensions import TRANSACTION_STATUS_INERROR
149150
params.update({
150151
'trans_id': self.logger.get_transaction_id(alias),
151152
'trans_status': conn.get_transaction_status(),
152-
'iso_level': conn.isolation_level,
153+
'iso_level': conn.isolation_level if not conn.get_transaction_status() == TRANSACTION_STATUS_INERROR else "",
153154
'encoding': conn.encoding,
154155
})
155156

0 commit comments

Comments
 (0)