Skip to content

Commit 6ec6bfe

Browse files
authored
Merge pull request #1475 from saemideluxe/patch-1
Fixes #1239
2 parents ebd4ae3 + 7e2c161 commit 6ec6bfe

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

debug_toolbar/panels/sql/tracking.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ def cursor(*args, **kwargs):
5555
)
5656

5757
def chunked_cursor(*args, **kwargs):
58-
return state.Wrapper(
59-
connection._djdt_chunked_cursor(*args, **kwargs), connection, panel
60-
)
58+
# prevent double wrapping
59+
# solves https://github.com/jazzband/django-debug-toolbar/issues/1239
60+
cursor = connection._djdt_chunked_cursor(*args, **kwargs)
61+
if not isinstance(cursor, state.Wrapper):
62+
return state.Wrapper(cursor, connection, panel)
63+
return cursor
6164

6265
connection.cursor = cursor
6366
connection.chunked_cursor = chunked_cursor

0 commit comments

Comments
 (0)