示例#1
0
func (this *jsonArgs) getTristate(f string) (value.Tristate, errors.Error) {
	value_tristate := value.NONE
	value_field, in_request := this.args[f]
	if !in_request {
		return value_tristate, nil
	}

	b, type_ok := value_field.(bool)
	if !type_ok {
		return value_tristate, errors.NewServiceErrorTypeMismatch(f, "boolean")
	}

	value_tristate = value.ToTristate(b)
	return value_tristate, nil
}
示例#2
0
func (this *urlArgs) getTristate(f string) (value.Tristate, errors.Error) {
	tristate_value := value.NONE
	value_field, err := this.formValue(f)
	if err != nil {
		return tristate_value, err
	}
	if value_field == "" {
		return tristate_value, nil
	}
	bool_value, e := strconv.ParseBool(value_field)
	if e != nil {
		return tristate_value, errors.NewServiceErrorBadValue(e, f)
	}
	tristate_value = value.ToTristate(bool_value)
	return tristate_value, nil
}