Skip to content

Commit eee102e

Browse files
committed
Extract common base cursor wrapper class
1 parent 6ec6bfe commit eee102e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

debug_toolbar/panels/sql/tracking.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def chunked_cursor(*args, **kwargs):
5858
# prevent double wrapping
5959
# solves https://github.com/jazzband/django-debug-toolbar/issues/1239
6060
cursor = connection._djdt_chunked_cursor(*args, **kwargs)
61-
if not isinstance(cursor, state.Wrapper):
61+
if not isinstance(cursor, BaseCursorWrapper):
6262
return state.Wrapper(cursor, connection, panel)
6363
return cursor
6464

@@ -74,7 +74,11 @@ def unwrap_cursor(connection):
7474
del connection.chunked_cursor
7575

7676

77-
class ExceptionCursorWrapper:
77+
class BaseCursorWrapper:
78+
pass
79+
80+
81+
class ExceptionCursorWrapper(BaseCursorWrapper):
7882
"""
7983
Wraps a cursor and raises an exception on any operation.
8084
Used in Templates panel.
@@ -87,7 +91,7 @@ def __getattr__(self, attr):
8791
raise SQLQueryTriggered()
8892

8993

90-
class NormalCursorWrapper:
94+
class NormalCursorWrapper(BaseCursorWrapper):
9195
"""
9296
Wraps a cursor and logs queries.
9397
"""

0 commit comments

Comments
 (0)