Skip to content

Commit 3ef6e69

Browse files
authored
Refs #1668: Fixed the unsortable session keys fallback (#1994)
* Refs #1668: Fixed the unsortable session keys fallback * Disable the flake8-simplify ruleset
1 parent 6fc5ce8 commit 3ef6e69

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

debug_toolbar/panels/request.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,8 @@ def generate_stats(self, request, response):
6464
(k, request.session.get(k)) for k in sorted(request.session.keys())
6565
]
6666
except TypeError:
67-
session_list = [(k, request.session.get(k)) for k in request.session]
67+
session_list = [
68+
(k, request.session.get(k))
69+
for k in request.session.keys() # (it's not a dict)
70+
]
6871
self.record_stats({"session": {"list": session_list}})

docs/changes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Pending
1313
* Add translations for Bulgarian and Korean.
1414
* Update translations for several languages.
1515
* Include new translatable strings for translation.
16+
* Fixed a crash which happened in the fallback case when session keys cannot be
17+
sorted.
1618

1719
4.4.6 (2024-07-10)
1820
------------------

pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,14 @@ lint.extend-select = [
7474
"PGH", # pygrep-hooks
7575
"PIE", # flake8-pie
7676
"RUF100", # Unused noqa directive
77-
"SIM", # flake8-simplify
7877
"SLOT", # flake8-slots
7978
"UP", # pyupgrade
8079
"W", # pycodestyle warnings
8180
]
8281
lint.extend-ignore = [
83-
"B905", # Allow zip() without strict=
84-
"E501", # Ignore line length violations
85-
"SIM108", # Use ternary operator instead of if-else-block
86-
"UP031", # It's not always wrong to use percent-formatting
82+
"B905", # Allow zip() without strict=
83+
"E501", # Ignore line length violations
84+
"UP031", # It's not always wrong to use percent-formatting
8785
]
8886
lint.per-file-ignores."*/migrat*/*" = [
8987
"N806", # Allow using PascalCase model names in migrations

0 commit comments

Comments
 (0)