Skip to content

Commit 9d81d35

Browse files
Merge branch 'main' into hide-migrations
2 parents f4941fb + 45bc2db commit 9d81d35

File tree

13 files changed

+55
-20
lines changed

13 files changed

+55
-20
lines changed

.git-blame-ignore-revs

Whitespace-only changes.

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Build a binary wheel and a source tarball
2525
run: python3 -m build
2626
- name: Store the distribution packages
27-
uses: actions/upload-artifact@v4
27+
uses: actions/upload-artifact@v5
2828
with:
2929
name: python-package-distributions
3030
path: dist/
@@ -43,7 +43,7 @@ jobs:
4343
id-token: write # IMPORTANT: mandatory for trusted publishing
4444
steps:
4545
- name: Download all the dists
46-
uses: actions/download-artifact@v5
46+
uses: actions/download-artifact@v6
4747
with:
4848
name: python-package-distributions
4949
path: dist/
@@ -64,12 +64,12 @@ jobs:
6464

6565
steps:
6666
- name: Download all the dists
67-
uses: actions/download-artifact@v5
67+
uses: actions/download-artifact@v6
6868
with:
6969
name: python-package-distributions
7070
path: dist/
7171
- name: Sign the dists with Sigstore
72-
uses: sigstore/gh-action-sigstore-python@v3.0.1
72+
uses: sigstore/gh-action-sigstore-python@v3.1.0
7373
with:
7474
inputs: >-
7575
./dist/*.tar.gz
@@ -109,7 +109,7 @@ jobs:
109109

110110
steps:
111111
- name: Download all the dists
112-
uses: actions/download-artifact@v5
112+
uses: actions/download-artifact@v6
113113
with:
114114
name: python-package-distributions
115115
path: dist/

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
hooks:
1515
- id: doc8
1616
- repo: https://github.com/adamchainz/django-upgrade
17-
rev: 1.29.0
17+
rev: 1.29.1
1818
hooks:
1919
- id: django-upgrade
2020
args: [--target-version, "4.2"]
@@ -29,18 +29,18 @@ repos:
2929
- id: rst-backticks
3030
- id: rst-directive-colons
3131
- repo: https://github.com/biomejs/pre-commit
32-
rev: v2.2.5
32+
rev: v2.3.1
3333
hooks:
3434
- id: biome-check
3535
verbose: true
3636
- repo: https://github.com/astral-sh/ruff-pre-commit
37-
rev: 'v0.14.0'
37+
rev: 'v0.14.2'
3838
hooks:
3939
- id: ruff
4040
args: [--fix, --exit-non-zero-on-fix]
4141
- id: ruff-format
4242
- repo: https://github.com/tox-dev/pyproject-fmt
43-
rev: v2.10.0
43+
rev: v2.11.0
4444
hooks:
4545
- id: pyproject-fmt
4646
- repo: https://github.com/abravalheri/validate-pyproject

debug_toolbar/forms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from django import forms
44
from django.core import signing
55
from django.core.exceptions import ValidationError
6-
from django.utils.encoding import force_str
6+
7+
from debug_toolbar.sanitize import force_str
78

89

910
class SignedDataForm(forms.Form):

debug_toolbar/panels/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from django.utils.encoding import force_str
21
from django.utils.translation import gettext_lazy as _
32
from django.views.debug import get_default_exception_reporter_filter
43

54
from debug_toolbar.panels import Panel
5+
from debug_toolbar.sanitize import force_str
66

77
get_safe_settings = get_default_exception_reporter_filter().get_safe_settings
88

debug_toolbar/panels/sql/tracking.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from time import perf_counter
66

77
import django.test.testcases
8-
from django.utils.encoding import force_str
98

9+
from debug_toolbar.sanitize import force_str
1010
from debug_toolbar.utils import get_stack_trace, get_template_info
1111

1212
try:
@@ -128,10 +128,7 @@ def _decode(self, param):
128128

129129
# make sure datetime, date and time are converted to string by force_str
130130
CONVERT_TYPES = (datetime.datetime, datetime.date, datetime.time)
131-
try:
132-
return force_str(param, strings_only=not isinstance(param, CONVERT_TYPES))
133-
except UnicodeDecodeError:
134-
return "(encoded string)"
131+
return force_str(param, strings_only=not isinstance(param, CONVERT_TYPES))
135132

136133
def _last_executed_query(self, sql, params):
137134
"""Get the last executed query from the connection."""

debug_toolbar/panels/templates/panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
from django.test.signals import template_rendered
1111
from django.test.utils import instrumented_test_render
1212
from django.urls import path
13-
from django.utils.encoding import force_str
1413
from django.utils.translation import gettext_lazy as _
1514

1615
from debug_toolbar.panels import Panel
1716
from debug_toolbar.panels.sql.tracking import SQLQueryTriggered, allow_sql
1817
from debug_toolbar.panels.templates import views
18+
from debug_toolbar.sanitize import force_str
1919

2020
if find_spec("jinja2"):
2121
from debug_toolbar.panels.templates.jinja2 import patch_jinja_render

debug_toolbar/sanitize.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from django.utils.encoding import DjangoUnicodeDecodeError, force_str as force_string
2+
3+
4+
def force_str(s, *args, **kwargs):
5+
"""
6+
Forces values to strings.
7+
Will return "Django Debug Toolbar was unable to parse value." when there's a decoding error.
8+
"""
9+
try:
10+
return force_string(s, *args, **kwargs)
11+
except DjangoUnicodeDecodeError:
12+
return "Django Debug Toolbar was unable to parse value."

debug_toolbar/store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
from django.core.serializers.json import DjangoJSONEncoder
88
from django.db import transaction
9-
from django.utils.encoding import force_str
109
from django.utils.module_loading import import_string
1110

1211
from debug_toolbar import settings as dt_settings
1312
from debug_toolbar.models import HistoryEntry
13+
from debug_toolbar.sanitize import force_str
1414

1515

1616
class DebugToolbarJSONEncoder(DjangoJSONEncoder):

docs/architecture.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,5 @@ Problematic Parts
8585
fully compatible and currently being worked on. For now, these panels
8686
are disabled by default when running in async environment.
8787
follow the progress of this issue in `Async compatible toolbar project <https://github.com/orgs/jazzband/projects/9>`_.
88+
- Django Channels incompatibility: The toolbar does not currently support
89+
Django Channels' consumers due to the difference in middleware design.

0 commit comments

Comments
 (0)