@@ -249,16 +249,16 @@ def set_charset(self, charset):
249249 # BAW: should we accept strings that can serve as arguments to the
250250 # Charset constructor?
251251 self ._charset = charset
252- if not self . has_key ( 'MIME-Version' ) :
252+ if 'MIME-Version' not in self :
253253 self .add_header ('MIME-Version' , '1.0' )
254- if not self . has_key ( 'Content-Type' ) :
254+ if 'Content-Type' not in self :
255255 self .add_header ('Content-Type' , 'text/plain' ,
256256 charset = charset .get_output_charset ())
257257 else :
258258 self .set_param ('charset' , charset .get_output_charset ())
259259 if str (charset ) != charset .get_output_charset ():
260260 self ._payload = charset .body_encode (self ._payload )
261- if not self . has_key ( 'Content-Transfer-Encoding' ) :
261+ if 'Content-Transfer-Encoding' not in self :
262262 cte = charset .get_body_encoding ()
263263 try :
264264 cte (self )
@@ -551,7 +551,7 @@ def get_param(self, param, failobj=None, header='content-type',
551551 VALUE item in the 3-tuple) is always unquoted, unless unquote is set
552552 to False.
553553 """
554- if not self . has_key ( header ) :
554+ if header not in self :
555555 return failobj
556556 for k , v in self ._get_params_preserve (failobj , header ):
557557 if k .lower () == param .lower ():
@@ -582,7 +582,7 @@ def set_param(self, param, value, header='Content-Type', requote=True,
582582 if not isinstance (value , tuple ) and charset :
583583 value = (charset , language , value )
584584
585- if not self . has_key ( header ) and header .lower () == 'content-type' :
585+ if header not in self and header .lower () == 'content-type' :
586586 ctype = 'text/plain'
587587 else :
588588 ctype = self .get (header )
@@ -617,7 +617,7 @@ def del_param(self, param, header='content-type', requote=True):
617617 False. Optional header specifies an alternative to the Content-Type
618618 header.
619619 """
620- if not self . has_key ( header ) :
620+ if header not in self :
621621 return
622622 new_ctype = ''
623623 for p , v in self .get_params (header = header , unquote = requote ):
@@ -653,7 +653,7 @@ def set_type(self, type, header='Content-Type', requote=True):
653653 if header .lower () == 'content-type' :
654654 del self ['mime-version' ]
655655 self ['MIME-Version' ] = '1.0'
656- if not self . has_key ( header ) :
656+ if header not in self :
657657 self [header ] = type
658658 return
659659 params = self .get_params (header = header , unquote = requote )
0 commit comments