(option, value)
Validates that 'value' is an integer (or basestring representation).
Validates that 'value' is an integer (or basestring representation).
Validates that value is an integer ( or basestring representation ) .
def validate_integer(option, value):
    """Validates that 'value' is an integer (or basestring representation).
    """
    if isinstance(value, integer_types):
        return value
    elif isinstance(value, string_type):
        if not value.isdigit():
            raise ValueError("The value of %s must be "
                             "an integer" % (option,))
        return int(value)
    raise TypeError("Wrong type for %s, value must be an integer" % (option,))
def validate_integer ( option , value ) : if isinstance ( value , integer_types ) : return value elif isinstance ( value , string_type ) : if not value . isdigit ( ) : raise ValueError ( "The value of %s must be " "an integer" % ( option , ) ) return int ( value ) raise TypeError ( "Wrong type for %s, value must be an integer" % ( option , ) )