From 706988514f3c0f508b671e9774c49e374df1795e Mon Sep 17 00:00:00 2001 From: Vincent Alsteen Date: Thu, 21 Jun 2012 16:41:56 +0200 Subject: Fixed issue #230 -- prevent crash when transaction is in error state fix for ticket https://github.com/django-debug-toolbar/django-debug-toolbar/issues/230 if isolation_level is looked up while transaction is in an error state, an exception is thrown, which eats up the original exception that is never shown --- debug_toolbar/utils/tracking/db.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'debug_toolbar/utils/tracking') diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py index 4d87090..70ff700 100644 --- a/debug_toolbar/utils/tracking/db.py +++ b/debug_toolbar/utils/tracking/db.py @@ -146,10 +146,11 @@ class NormalCursorWrapper(object): } if engine == 'psycopg2': + from psycopg2.extensions import TRANSACTION_STATUS_INERROR params.update({ 'trans_id': self.logger.get_transaction_id(alias), 'trans_status': conn.get_transaction_status(), - 'iso_level': conn.isolation_level, + 'iso_level': conn.isolation_level if not conn.get_transaction_status() == TRANSACTION_STATUS_INERROR else "", 'encoding': conn.encoding, }) -- cgit v1.2.3