def multiple_choice_validator(opt_dict, name, value): """validate and return a converted value for option of type 'choice' """ choices = opt_dict['choices'] values = check_csv(None, name, value) for value in values: if not value in choices: msg = "option %s: invalid value: %r, should be in %s" raise OptionValueError(msg % (name, value, choices)) return values
def csv_validator(opt_dict, name, value): """validate and return a converted value for option of type 'csv' """ return check_csv(None, name, value)