(option, value)
Validates that 'value' is an integer or string.
Validates that 'value' is an integer or string.
Validates that value is an integer or string .
def validate_int_or_basestring(option, value):
    """Validates that 'value' is an integer or string.
    """
    if isinstance(value, integer_types):
        return value
    elif isinstance(value, string_type):
        if value.isdigit():
            return int(value)
        return value
    raise TypeError("Wrong type for %s, value must be an "
                    "integer or a string" % (option,))
def validate_int_or_basestring ( option , value ) : if isinstance ( value , integer_types ) : return value elif isinstance ( value , string_type ) : if value . isdigit ( ) : return int ( value ) return value raise TypeError ( "Wrong type for %s, value must be an " "integer or a string" % ( option , ) )