本文整理汇总了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(),
}
示例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)
示例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(),
}