New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Python 3 #373
Changes from 32 commits
eb0d02d
eb53791
005ca0b
c73c77a
c58094b
e749ab1
f6aad29
f1d5de5
61d1286
e4e8388
e3723e3
bab0aee
417c852
3929d60
068a6c1
7cb3cb0
c2485f5
61bbd7f
cdfa803
494f421
a30c83f
6e50c9f
47ea676
76a8159
f5d4cde
0e6983a
a088ed0
3aa8c4c
7a21c54
fa40aa1
ee44437
fd2bb66
09203c6
9a924cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import re | ||
import uuid | ||
import sqlparse | ||
|
||
from django.db.backends import BaseDatabaseWrapper | ||
from django.utils.html import escape | ||
from django.utils.translation import ugettext_lazy as _, ungettext_lazy as __ | ||
from django.utils.six import itervalues | ||
|
||
from debug_toolbar.utils.compat.db import connections | ||
from debug_toolbar.middleware import DebugToolbarMiddleware | ||
from debug_toolbar.panels import DebugPanel | ||
from debug_toolbar.utils import sqlparse, render_stacktrace | ||
from debug_toolbar.utils import render_stacktrace | ||
from debug_toolbar.utils.tracking.db import CursorWrapper | ||
from debug_toolbar.utils.tracking import replace_call | ||
from debug_toolbar.utils.tracking import monkey_patch_call | ||
|
||
|
||
# Inject our tracking cursor | ||
@replace_call(BaseDatabaseWrapper.cursor) | ||
@monkey_patch_call(BaseDatabaseWrapper, 'cursor') | ||
def cursor(func, self): | ||
result = func(self) | ||
|
||
|
@@ -25,6 +27,8 @@ def cursor(func, self): | |
|
||
return CursorWrapper(result, self, logger=logger) | ||
|
||
BaseDatabaseWrapper.cursor = cursor | ||
|
||
|
||
def get_isolation_level_display(engine, level): | ||
if engine == 'psycopg2': | ||
|
@@ -134,7 +138,7 @@ def process_response(self, request, response): | |
if self._queries: | ||
width_ratio_tally = 0 | ||
factor = int(256.0 / (len(self._databases) * 2.5)) | ||
for n, db in enumerate(self._databases.itervalues()): | ||
for n, db in enumerate(itervalues(self._databases)): | ||
rgb = [0, 0, 0] | ||
color = n % 3 | ||
rgb[color] = 256 - n / 3 * factor | ||
|
@@ -195,7 +199,7 @@ def process_response(self, request, response): | |
}) | ||
|
||
|
||
class BoldKeywordFilter(sqlparse.filters.Filter): | ||
class BoldKeywordFilter(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filter no longer exists in sqlparse
|
||
"""sqlparse filter to bold SQL keywords""" | ||
def process(self, stack, stream): | ||
"""Process the token stream""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could remove the extra spacing after the
print(
in the above 2 lines.