本文整理汇总了Python中mkt.reviewers.models.ReviewerScore.award_mark_abuse_points方法的典型用法代码示例。如果您正苦于以下问题:Python ReviewerScore.award_mark_abuse_points方法的具体用法?Python ReviewerScore.award_mark_abuse_points怎么用?Python ReviewerScore.award_mark_abuse_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.reviewers.models.ReviewerScore
的用法示例。
在下文中一共展示了ReviewerScore.award_mark_abuse_points方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from mkt.reviewers.models import ReviewerScore [as 别名]
# 或者: from mkt.reviewers.models.ReviewerScore import award_mark_abuse_points [as 别名]
def save(self):
for form in self.forms:
if form.cleaned_data:
action = int(form.cleaned_data['action'])
if action == ABUSE_REPORT_SKIP:
continue
inst = form.instance
app = None
site = None
user = None
texts = []
for report in inst.abuse_reports.all().filter(read=False):
report.read = True
report.save()
app = report.addon
site = report.website
user = report.user
if report.message:
texts.append(report.message)
if app:
mkt.log(mkt.LOG.APP_ABUSE_MARKREAD, app, report,
details=dict(
body=unicode(report.message),
addon_id=app.id,
addon_title=unicode(app.name)
))
elif user:
# Not possible on Marketplace currently.
pass
elif site:
mkt.log(mkt.LOG.WEBSITE_ABUSE_MARKREAD, site,
report,
details=dict(
body=unicode(report.message),
website_id=site.id,
website_title=unicode(site.name)
))
if app or site:
ReviewerScore.award_mark_abuse_points(
self.request.user, addon=app, website=site)
if app and action == ABUSE_REPORT_FLAG:
message = _('Abuse reports needing investigation: %s' %
(', '.join(texts)))
RereviewQueue.flag(
app, mkt.LOG.REREVIEW_ABUSE_APP, message=message)
示例2: test_award_mark_abuse_points_website
# 需要导入模块: from mkt.reviewers.models import ReviewerScore [as 别名]
# 或者: from mkt.reviewers.models.ReviewerScore import award_mark_abuse_points [as 别名]
def test_award_mark_abuse_points_website(self):
ReviewerScore.award_mark_abuse_points(self.user, website=self.website)
score = ReviewerScore.objects.all()[0]
eq_(score.score, mkt.REVIEWED_SCORES.get(
mkt.REVIEWED_WEBSITE_ABUSE_REPORT))
eq_(score.note_key, mkt.REVIEWED_WEBSITE_ABUSE_REPORT)
示例3: test_award_mark_abuse_points_app
# 需要导入模块: from mkt.reviewers.models import ReviewerScore [as 别名]
# 或者: from mkt.reviewers.models.ReviewerScore import award_mark_abuse_points [as 别名]
def test_award_mark_abuse_points_app(self):
ReviewerScore.award_mark_abuse_points(self.user, addon=self.app)
score = ReviewerScore.objects.all()[0]
eq_(score.score, mkt.REVIEWED_SCORES.get(
mkt.REVIEWED_APP_ABUSE_REPORT))
eq_(score.note_key, mkt.REVIEWED_APP_ABUSE_REPORT)