本文整理汇总了Python中issues.models.Issue.svn_commit_id方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.svn_commit_id方法的具体用法?Python Issue.svn_commit_id怎么用?Python Issue.svn_commit_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类issues.models.Issue
的用法示例。
在下文中一共展示了Issue.svn_commit_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _submit_review
# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import svn_commit_id [as 别名]
def _submit_review(self, request, task, svn_path):
user = request.user
try:
rev_a = int(request.POST.get('rev_a'))
rev_b = int(request.POST.get('rev_b'))
except TypeError: #not int
return HttpResponseForbidden()
except ValueError: #not int
return HttpResponseForbidden()
if rev_a == rev_b:
return HttpResponseForbidden()
if rev_b < rev_a:
rev_a, rev_b = rev_b, rev_a
review_id = None
try:
issue = Issue.objects.filter(task=task, student=user).order_by('-update_time')[0]
review_id = issue.rb_review_id
except Issue.DoesNotExist:
pass
except IndexError:
pass
issue = Issue()
issue.task = task
issue.student = user
issue.svn_commit_id = rev_b
summary = u"[{0}][{1}] {2}".format(user.get_full_name(), task.course.get_user_group(user), task.title)
review_group_name = settings.RB_API_DEFAULT_REVIEW_GROUP
if task.course.name_id:
review_group_name = "teachers_{0}".format(task.course.name_id)
else:
try:
review_group_name = "teachers_{0}".format(task.course.name)
except Exception:
pass
review_group_name = review_group_name.replace(".", "_")
review_group_name = review_group_name.replace("/", "_")
review_group_name = review_group_name.lower()
anyrb = AnyRB()
description = self._get_description(request, task, svn_path, rev_a, rev_b)
if review_id is None:
review_id = anyrb.submit_review(user, rev_a, rev_b, summary=summary, description=description, review_group_name=", ".join((review_group_name, settings.RB_API_DEFAULT_REVIEW_GROUP)), path=svn_path)
else:
anyrb.update_review(user, rev_a, rev_b, review_id, description=description, path=svn_path)
issue.rb_review_id = review_id
issue.save()
context = {
'review_url' : anyrb.get_review_url(request, review_id),
'task' : task,
}
return render_to_response('submit_review_done.html', context, context_instance=RequestContext(request))