예제 #1
0
파일: option.py 프로젝트: isabella232/mezzo
def check_choice(option, opt, value):
    if value in option.choices:
        return value
    else:
        choices = string.join(map(repr, option.choices), ", ")
        raise OptionValueError(
            "option %s: invalid choice: %s (choose from %s)" %
            (opt, repr(value), choices))
예제 #2
0
파일: option.py 프로젝트: isabella232/mezzo
def check_builtin(option, opt, value):
    (cvt, what) = _builtin_cvt[option.type]
    try:
        return cvt(value)
    except ValueError:
        raise OptionValueError(
            #"%s: invalid %s argument %s" % (opt, what, repr(value)))
            "option %s: invalid %s value: %s" % (opt, what, repr(value)))