@@ -33,7 +33,8 @@ def _add_field_value(self, field_name: str, value: Union[str, bytes]) -> None:
3333 else :
3434 self ._storage [field_name ].append (value )
3535
36- def _html_output_encode (self , value ):
36+ @staticmethod
37+ def _html_output_encode (value ):
3738 return (
3839 str (value )
3940 .replace ("&" , "&" )
@@ -43,12 +44,13 @@ def _html_output_encode(self, value):
4344 .replace ("'" , "'" )
4445 )
4546
46- def _debug_warning_nonencoded_output (self ):
47+ @staticmethod
48+ def _debug_warning_nonencoded_output ():
4749 """Warns about exposing all files on the device."""
4850 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 "
5052 "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."
5254 )
5355
5456 def get (
@@ -57,9 +59,9 @@ def get(
5759 """Get the value of a field."""
5860 if html_output_encode :
5961 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 ]
6365
6466 def get_list (self , field_name : str ) -> List [Union [str , bytes ]]:
6567 """Get the list of values of a field."""
0 commit comments