@webapi_login_required
    @webapi_check_local_site
    @webapi_response_errors(DOES_NOT_EXIST, NOT_LOGGED_IN, PERMISSION_DENIED)
    @webapi_request_fields(
        optional={
            'status': {
                'type': ('Q', 'R', 'S', 'F', 'T'),
                'description': 'The status of the tool execution.',
            },
            'result': {
                'type': str,
                'description': 'A JSON payload containing the result of the '
                               'tool execution.',
            },
        },
    )
    def update(self, request, *args, **kwargs):
        """Updates an existing tool execution.

        Only Review Bot workers are allowed to update a tool execution's
        information.

        The last-updated time will automatically be updated upon a PUT request.
        Optionally, the worker can update the execution status, or store the
        result of the execution (the completed review or error details) as a
        JSON blob.
        """
        if not self.has_modify_permissions(request):
            return self._no_access_error(request.user)

        try:
            tool_execution = self.get_object(request, *args, **kwargs)
        except __HOLE__:
            return DOES_NOT_EXIST

        for field in ('status', 'result'):
            value = kwargs.get(field, None)

            if value is not None:
                setattr(tool_execution, field, value)

        tool_execution.save()

        return 200, {
            self.item_result_key: tool_execution,
        }
dataset/ETHPy150Open reviewboard/ReviewBot/extension/reviewbotext/resources.py/ToolExecutionResource.update