@@ -33,7 +33,8 @@ def _add_field_value(self, field_name: str, value: Union[str, bytes]) -> None:
33
33
else :
34
34
self ._storage [field_name ].append (value )
35
35
36
- def _html_output_encode (self , value ):
36
+ @staticmethod
37
+ def _html_output_encode (value ):
37
38
return (
38
39
str (value )
39
40
.replace ("&" , "&" )
@@ -43,12 +44,13 @@ def _html_output_encode(self, value):
43
44
.replace ("'" , "'" )
44
45
)
45
46
46
- def _debug_warning_nonencoded_output (self ):
47
+ @staticmethod
48
+ def _debug_warning_nonencoded_output ():
47
49
"""Warns about exposing all files on the device."""
48
50
print (
49
- f "WARNING: Setting html_output_encode to False will make XSS vulnerabilities possible by "
51
+ "WARNING: Setting html_output_encode to False makes XSS vulnerabilities possible by "
50
52
"allowing access to raw untrusted values submitted by users. If this data is reflected "
51
- "or shown within HTML without proper encoding it could enable Cross-Site Scripting attacks ."
53
+ "or shown within HTML without proper encoding it could enable Cross-Site Scripting."
52
54
)
53
55
54
56
def get (
@@ -57,9 +59,9 @@ def get(
57
59
"""Get the value of a field."""
58
60
if html_output_encode :
59
61
return self ._html_output_encode (self ._storage .get (field_name , [default ])[0 ])
60
- else :
61
- self ._debug_warning_nonencoded_output ()
62
- return self ._storage .get (field_name , [default ])[0 ]
62
+
63
+ self ._debug_warning_nonencoded_output ()
64
+ return self ._storage .get (field_name , [default ])[0 ]
63
65
64
66
def get_list (self , field_name : str ) -> List [Union [str , bytes ]]:
65
67
"""Get the list of values of a field."""
0 commit comments