aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/utils
diff options
context:
space:
mode:
authorVincent Alsteen2012-06-21 16:41:56 +0200
committerVincent Alsteen2012-09-03 13:54:06 +0200
commit706988514f3c0f508b671e9774c49e374df1795e (patch)
tree542dab01412d4adbd897ad842f8690b694b407f9 /debug_toolbar/utils
parent62f44558f4edfcc36d71686076d7bb832f9dd993 (diff)
downloaddjango-debug-toolbar-706988514f3c0f508b671e9774c49e374df1795e.tar.bz2
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
Diffstat (limited to 'debug_toolbar/utils')
-rw-r--r--debug_toolbar/utils/tracking/db.py3
1 files changed, 2 insertions, 1 deletions
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,
})