def view_set(method_name):
    """
    Creates a setter that will call the view method with the context's
    key as first parameter and the value as second parameter.
    @param method_name: the name of a method belonging to the view.
    @type method_name: str
    """

    def view_set(value, context, **_params):
        method = getattr(context["view"], method_name)
        return _set(method, context["key"], value, (), {})

    return view_set