File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
from django .utils .encoding import force_str
2
2
from django .utils .translation import gettext_lazy as _
3
3
from django .views .debug import get_default_exception_reporter_filter
4
+ from django .utils .encoding import DjangoUnicodeDecodeError
4
5
5
6
from debug_toolbar .panels import Panel
6
7
@@ -24,10 +25,17 @@ def title(self):
24
25
)
25
26
26
27
def generate_stats (self , request , response ):
28
+
29
+ def catch_force_errors (force_function , value ):
30
+ try :
31
+ return force_function (value )
32
+ except DjangoUnicodeDecodeError :
33
+ return 'Debug toolbar was unable to parse value'
34
+
27
35
self .record_stats (
28
36
{
29
37
"settings" : {
30
- key : force_str ( value )
38
+ key : catch_force_errors ( force_str , value )
31
39
for key , value in sorted (get_safe_settings ().items ())
32
40
}
33
41
}
Original file line number Diff line number Diff line change 3
3
from ..base import IntegrationTestCase
4
4
5
5
6
- @override_settings (DEBUG = True )
6
+ @override_settings (DEBUG = True , RANDOM_SETTING = bytes . fromhex ( "a3f2b8c14e972d5a8fb3c7291a64e0859c472bf63d18a0945e73b2c84f917ae2" ) )
7
7
class SettingsIntegrationTestCase (IntegrationTestCase ):
8
8
def test_panel_title (self ):
9
9
response = self .client .get ("/regular/basic/" )
You can’t perform that action at this time.
0 commit comments