@@ -594,8 +594,8 @@ def _start_option(self, attrs):
594594
595595 self ._option = {}
596596 self ._option .update (d )
597- if (self ._optgroup and self . _optgroup . has_key ( "disabled" ) and
598- not self ._option . has_key ( "disabled" ) ):
597+ if (self ._optgroup and "disabled" in self . _optgroup and
598+ "disabled" not in self ._option ):
599599 self ._option ["disabled" ] = None
600600
601601 def _end_option (self ):
@@ -605,9 +605,9 @@ def _end_option(self):
605605
606606 contents = self ._option .get ("contents" , "" ).strip ()
607607 self ._option ["contents" ] = contents
608- if not self ._option . has_key ( "value" ) :
608+ if "value" not in self ._option :
609609 self ._option ["value" ] = contents
610- if not self ._option . has_key ( "label" ) :
610+ if "label" not in self ._option :
611611 self ._option ["label" ] = contents
612612 # stuff dict of SELECT HTML attrs into a special private key
613613 # (gets deleted again later)
@@ -695,7 +695,7 @@ def handle_data(self, data):
695695 else :
696696 return
697697
698- if data and not map . has_key ( key ) :
698+ if data and key not in map :
699699 # according to
700700 # http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.1 line break
701701 # immediately after start tags or immediately before end tags must
@@ -1624,7 +1624,7 @@ def __init__(self, control, attrs, index=None):
16241624 "_labels" : label and [label ] or [],
16251625 "attrs" : attrs ,
16261626 "_control" : control ,
1627- "disabled" : attrs . has_key ( "disabled" ) ,
1627+ "disabled" : "disabled" in attrs ,
16281628 "_selected" : False ,
16291629 "id" : attrs .get ("id" ),
16301630 "_index" : index ,
@@ -2292,7 +2292,7 @@ def __init__(self, type, name, attrs, select_default=False, index=None):
22922292 called_as_base_class = True , index = index )
22932293 self .__dict__ ["multiple" ] = False
22942294 o = Item (self , attrs , index )
2295- o .__dict__ ["_selected" ] = attrs . has_key ( "checked" )
2295+ o .__dict__ ["_selected" ] = "checked" in attrs
22962296
22972297 def fixup (self ):
22982298 ListControl .fixup (self )
@@ -2325,7 +2325,7 @@ def __init__(self, type, name, attrs, select_default=False, index=None):
23252325 called_as_base_class = True , index = index )
23262326 self .__dict__ ["multiple" ] = True
23272327 o = Item (self , attrs , index )
2328- o .__dict__ ["_selected" ] = attrs . has_key ( "checked" )
2328+ o .__dict__ ["_selected" ] = "checked" in attrs
23292329
23302330 def get_labels (self ):
23312331 return []
@@ -2393,20 +2393,20 @@ def __init__(self, type, name, attrs, select_default=False, index=None):
23932393 self .attrs = attrs ["__select" ].copy ()
23942394 self .__dict__ ["_label" ] = _get_label (self .attrs )
23952395 self .__dict__ ["id" ] = self .attrs .get ("id" )
2396- self .__dict__ ["multiple" ] = self . attrs . has_key ( "multiple" )
2396+ self .__dict__ ["multiple" ] = "multiple" in self . attrs
23972397 # the majority of the contents, label, and value dance already happened
23982398 contents = attrs .get ("contents" )
23992399 attrs = attrs .copy ()
24002400 del attrs ["__select" ]
24012401
24022402 ListControl .__init__ (self , type , name , self .attrs , select_default ,
24032403 called_as_base_class = True , index = index )
2404- self .disabled = self . attrs . has_key ( "disabled" )
2405- self .readonly = self . attrs . has_key ( "readonly" )
2406- if attrs . has_key ( "value" ) :
2404+ self .disabled = "disabled" in self . attrs
2405+ self .readonly = "readonly" in self . attrs
2406+ if "value" in attrs :
24072407 # otherwise it is a marker 'select started' token
24082408 o = Item (self , attrs , index )
2409- o .__dict__ ["_selected" ] = attrs . has_key ( "selected" )
2409+ o .__dict__ ["_selected" ] = "selected" in attrs
24102410 # add 'label' label and contents label, if different. If both are
24112411 # provided, the 'label' label is used for display in HTML
24122412 # 4.0-compliant browsers (and any lower spec? not sure) while the
0 commit comments