#NEWLINE# def _clean_rule_icmp( self , cleaned_data , rule_menu ) : #NEWLINE# #INDENT# icmp_type = cleaned_data . get ( 'icmp_type' , None ) #NEWLINE# icmp_code = cleaned_data . get ( 'icmp_code' , None ) #NEWLINE# self . _update_and_pop_error ( cleaned_data , 'ip_protocol' , rule_menu ) #NEWLINE# if ( icmp_type is None ) : #NEWLINE# #INDENT# msg = _ ( 'The ICMP type is invalid.' ) #NEWLINE# raise ValidationError ( msg ) #NEWLINE# #UNINDENT# if ( icmp_code is None ) : #NEWLINE# #INDENT# msg = _ ( 'The ICMP code is invalid.' ) #NEWLINE# raise ValidationError ( msg ) #NEWLINE# #UNINDENT# if ( icmp_type not in range ( ( - 1 ) , 256 ) ) : #NEWLINE# #INDENT# msg = _ ( 'The ICMP type not in range (-1, 255)' ) #NEWLINE# raise ValidationError ( msg ) #NEWLINE# #UNINDENT# if ( icmp_code not in range ( ( - 1 ) , 256 ) ) : #NEWLINE# #INDENT# msg = _ ( 'The ICMP code not in range (-1, 255)' ) #NEWLINE# raise ValidationError ( msg ) #NEWLINE# #UNINDENT# self . _update_and_pop_error ( cleaned_data , 'from_port' , icmp_type ) #NEWLINE# self . _update_and_pop_error ( cleaned_data , 'to_port' , icmp_code ) #NEWLINE# self . _update_and_pop_error ( cleaned_data , 'port' , None )