当前位置: 首页>>代码示例>>Python>>正文


Python BaseComment.issue_string_to_status方法代码示例

本文整理汇总了Python中reviewboard.reviews.models.BaseComment.issue_string_to_status方法的典型用法代码示例。如果您正苦于以下问题:Python BaseComment.issue_string_to_status方法的具体用法?Python BaseComment.issue_string_to_status怎么用?Python BaseComment.issue_string_to_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reviewboard.reviews.models.BaseComment的用法示例。


在下文中一共展示了BaseComment.issue_string_to_status方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_issue_status

# 需要导入模块: from reviewboard.reviews.models import BaseComment [as 别名]
# 或者: from reviewboard.reviews.models.BaseComment import issue_string_to_status [as 别名]
    def update_issue_status(self, request, comment_resource, *args, **kwargs):
        """Updates the issue status for a comment.

        Handles all of the logic for updating an issue status.
        """
        try:
            review_request = \
                resources.review_request.get_object(request, *args, **kwargs)
            comment = comment_resource.get_object(request, *args, **kwargs)
        except ObjectDoesNotExist:
            return DOES_NOT_EXIST

        # Check permissions to change the issue status
        if not comment.can_change_issue_status(request.user):
            return self.get_no_access_error(request)

        # We can only update the status of an issue if an issue has been
        # opened
        if not comment.issue_opened:
            raise PermissionDenied

        comment._review_request = review_request

        # We can only update the status of the issue
        issue_status = \
            BaseComment.issue_string_to_status(kwargs.get('issue_status'))
        comment.issue_status = issue_status
        comment.save(update_fields=['issue_status'])

        last_activity_time, updated_object = review_request.get_last_activity()

        return 200, {
            comment_resource.item_result_key: comment,
            'last_activity_time': last_activity_time.isoformat(),
        }
开发者ID:CharanKamal-CLI,项目名称:reviewboard,代码行数:37,代码来源:base_comment.py

示例2: should_update_issue_status

# 需要导入模块: from reviewboard.reviews.models import BaseComment [as 别名]
# 或者: from reviewboard.reviews.models.BaseComment import issue_string_to_status [as 别名]
    def should_update_issue_status(self, comment, issue_status=None,
                                   issue_opened=None, **kwargs):
        """Returns True if the comment should have its issue status updated.

        Determines if a comment should have its issue status updated based
        on the current state of the comment, the review, and the arguments
        passed in the request.
        """
        if not issue_status:
            return False

        issue_status = BaseComment.issue_string_to_status(issue_status)

        return (comment.review.get().public and
                (comment.issue_opened or issue_opened) and
                issue_status != comment.issue_status)
开发者ID:sambafeng,项目名称:reviewboard,代码行数:18,代码来源:base_comment.py

示例3: update_issue_status

# 需要导入模块: from reviewboard.reviews.models import BaseComment [as 别名]
# 或者: from reviewboard.reviews.models.BaseComment import issue_string_to_status [as 别名]
    def update_issue_status(self, request, comment_resource, *args, **kwargs):
        """Updates the issue status for a comment.

        Handles all of the logic for updating an issue status.
        """
        try:
            review_request = \
                resources.review_request.get_object(request, *args, **kwargs)
            comment = comment_resource.get_object(request, *args, **kwargs)
        except ObjectDoesNotExist:
            return DOES_NOT_EXIST

        # Check permissions to change the issue status
        if not comment.can_change_issue_status(request.user):
            return self.get_no_access_error(request)

        # We can only update the status of an issue if an issue has been
        # opened
        if not comment.issue_opened:
            raise PermissionDenied

        comment._review_request = review_request
        issue_status = \
            BaseComment.issue_string_to_status(kwargs.get('issue_status'))

        # If the issue requires verification, ensure that only people who are
        # authorized can close it.
        if (comment.require_verification and
            issue_status in (BaseComment.RESOLVED, BaseComment.DROPPED) and
            comment.issue_status in (BaseComment.OPEN,
                                     BaseComment.VERIFYING_RESOLVED,
                                     BaseComment.VERIFYING_DROPPED) and
            not comment.can_verify_issue_status(request.user)):
            return self.get_no_access_error(request)

        # We can only update the status of the issue
        comment.issue_status = issue_status
        comment.save(update_fields=['issue_status'])

        last_activity_time, updated_object = review_request.get_last_activity()

        return 200, {
            comment_resource.item_result_key: comment,
            'last_activity_time': last_activity_time.isoformat(),
        }
开发者ID:chipx86,项目名称:reviewboard,代码行数:47,代码来源:base_comment.py


注:本文中的reviewboard.reviews.models.BaseComment.issue_string_to_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。