def view_attr(attr_name):
    """
    Creates a setter that will set the specified view attribute
    to the current value.
    @param attr_name: the name of an attribute belonging to the view.
    @type attr_name: str
    """

    def view_attr(value, context, **_params):
        setattr(context["view"], attr_name, value)
        return _attr()

    return view_attr