本文整理汇总了Python中mkt.reviewers.models.RereviewQueue类的典型用法代码示例。如果您正苦于以下问题:Python RereviewQueue类的具体用法?Python RereviewQueue怎么用?Python RereviewQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RereviewQueue类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mark_for_rereview
def mark_for_rereview(addon, added_devices, removed_devices):
msg = _(u'Device(s) changed: {0}').format(', '.join(
[_(u'Added {0}').format(unicode(amo.DEVICE_TYPES[d].name))
for d in added_devices] +
[_(u'Removed {0}').format(unicode(amo.DEVICE_TYPES[d].name))
for d in removed_devices]))
RereviewQueue.flag(addon, amo.LOG.REREVIEW_DEVICES_ADDED, msg)
示例2: save
def save(self, addon, commit=False):
# We ignore `commit`, since we need it to be `False` so we can save
# the ManyToMany fields on our own.
addonform = super(AppFormBasic, self).save(commit=False)
addonform.save()
if 'manifest_url' in self.changed_data:
before_url = self.old_manifest_url
after_url = self.cleaned_data['manifest_url']
# If a non-admin edited the manifest URL, add to Re-review Queue.
if not acl.action_allowed(self.request, 'Admin', '%'):
log.info(u'[Webapp:%s] (Re-review) Manifest URL changed '
u'from %s to %s'
% (self.instance, before_url, after_url))
msg = (_(u'Manifest URL changed from {before_url} to '
u'{after_url}')
.format(before_url=before_url, after_url=after_url))
RereviewQueue.flag(self.instance,
amo.LOG.REREVIEW_MANIFEST_URL_CHANGE, msg)
# Refetch the new manifest.
log.info('Manifest %s refreshed for %s'
% (addon.manifest_url, addon))
update_manifests.delay([self.instance.id])
return addonform
示例3: mark_for_rereview_features_change
def mark_for_rereview_features_change(webapp, added_features,
removed_features):
# L10n: {0} is the list of requirements changes.
msg = _(u'Requirements changed: {0}').format(', '.join(
[_(u'Added {0}').format(f) for f in added_features] +
[_(u'Removed {0}').format(f) for f in removed_features]))
RereviewQueue.flag(webapp, mkt.LOG.REREVIEW_FEATURES_CHANGED, msg)
示例4: _flag_rereview_adult
def _flag_rereview_adult(app, ratings_body, rating):
"""Flag app for rereview if it receives an Adult content rating."""
old_rating = app.content_ratings.filter(ratings_body=ratings_body.id)
if not old_rating.exists():
return
if rating.adult and not old_rating[0].get_rating().adult:
RereviewQueue.flag(app, amo.LOG.CONTENT_RATING_TO_ADULT, message=_("Content rating changed to Adult."))
示例5: mark_for_rereview
def mark_for_rereview(addon, added_devices, removed_devices):
msg = _(u"Device(s) changed: {0}").format(
", ".join(
[_(u"Added {0}").format(unicode(mkt.DEVICE_TYPES[d].name)) for d in added_devices]
+ [_(u"Removed {0}").format(unicode(mkt.DEVICE_TYPES[d].name)) for d in removed_devices]
)
)
RereviewQueue.flag(addon, mkt.LOG.REREVIEW_DEVICES_ADDED, msg)
示例6: save
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)
示例7: save
def save(self):
if 'price' in self.cleaned_data:
premium = self.addon.premium
if not premium:
premium = AddonPremium()
premium.addon = self.addon
premium.price = self.cleaned_data['price']
premium.save()
upsell = self.addon.upsold
if self.cleaned_data['free']:
# Check if this app was already a premium version for another app.
if upsell and upsell.free != self.cleaned_data['free']:
upsell.delete()
if not upsell:
upsell = AddonUpsell(premium=self.addon)
upsell.free = self.cleaned_data['free']
upsell.save()
elif not self.cleaned_data['free'] and upsell:
upsell.delete()
# Check for free -> paid for already public apps.
premium_type = self.cleaned_data['premium_type']
if (self.addon.premium_type == amo.ADDON_FREE and
premium_type in amo.ADDON_PREMIUMS and
self.addon.status == amo.STATUS_PUBLIC):
# Free -> paid for public apps trigger re-review.
log.info(u'[Webapp:%s] (Re-review) Public app, free -> paid.' % (
self.addon))
RereviewQueue.flag(self.addon, amo.LOG.REREVIEW_FREE_TO_PAID)
self.addon.premium_type = premium_type
if self.addon.premium and waffle.switch_is_active('currencies'):
currencies = self.cleaned_data['currencies']
self.addon.premium.update(currencies=currencies)
self.addon.save()
# If they checked later in the wizard and then decided they want
# to keep it free, push to pending.
if not self.addon.needs_paypal() and self.addon.is_incomplete():
self.addon.mark_done()
示例8: _update_manifest
def _update_manifest(id):
webapp = Webapp.objects.get(pk=id)
file_ = webapp.get_latest_file()
_log(webapp, u'Fetching webapp manifest')
if not file_:
_log(webapp, u'Ignoring, no existing file')
return
# Fetch manifest, catching and logging any exception.
try:
content = _fetch_manifest(webapp.manifest_url)
except Exception, e:
msg = u'Failed to get manifest from %s. Error: %s' % (
webapp.manifest_url, e.message)
_log(webapp, msg, rereview=True, exc_info=True)
RereviewQueue.flag(webapp, amo.LOG.REREVIEW_MANIFEST_CHANGE, msg)
return
示例9: save
def save(self, addon, commit=False):
# We ignore `commit`, since we need it to be `False` so we can save
# the ManyToMany fields on our own.
addonform = super(AppFormBasic, self).save(commit=False)
addonform.save()
if 'manifest_url' in self.changed_data:
before_url = self.old_manifest_url
after_url = self.cleaned_data['manifest_url']
# If a non-admin edited the manifest URL, add to Re-review Queue.
if not acl.action_allowed(self.request, 'Admin', '%'):
log.info(u'[Webapp:%s] (Re-review) Manifest URL changed '
u'from %s to %s'
% (self.instance, before_url, after_url))
msg = (_(u'Manifest URL changed from {before_url} to '
u'{after_url}')
.format(before_url=before_url, after_url=after_url))
RereviewQueue.flag(self.instance,
mkt.LOG.REREVIEW_MANIFEST_URL_CHANGE, msg)
# Refetch the new manifest.
log.info('Manifest %s refreshed for %s'
% (addon.manifest_url, addon))
update_manifests.delay([self.instance.id])
tags_new = self.cleaned_data['tags']
tags_old = [slugify(t, spaces=True) for t in self.get_tags(addon)]
add_tags = set(tags_new) - set(tags_old)
del_tags = set(tags_old) - set(tags_new)
# Add new tags.
for t in add_tags:
Tag(tag_text=t).save_tag(addon)
# Remove old tags.
for t in del_tags:
Tag(tag_text=t).remove_tag(addon)
return addonform
示例10: save
def save(self):
if self.cleaned_data.get('accounts'):
try:
log.info('[[email protected]%s] Attempting to delete app payment account'
% self.webapp.pk)
WebappPaymentAccount.objects.get(
webapp=self.webapp,
payment_account__provider=self.provider.provider
).delete()
except WebappPaymentAccount.DoesNotExist:
log.info('[[email protected]%s] Deleting failed, this is usually fine'
% self.webapp.pk)
log.info('[[email protected]%s] Creating new app payment account' %
self.webapp.pk)
account = self.cleaned_data['accounts']
uri = self.provider.product_create(account, self.webapp)
WebappPaymentAccount.objects.create(
webapp=self.webapp, account_uri=account.uri,
payment_account=account, product_uri=uri)
# If the app is marked as paid and the information is complete
# and the app is currently marked as incomplete, put it into the
# re-review queue.
if (self.webapp.status == mkt.STATUS_NULL and
self.webapp.highest_status
in mkt.WEBAPPS_APPROVED_STATUSES):
# FIXME: This might cause noise in the future if bank accounts
# get manually closed by Bango and we mark apps as STATUS_NULL
# until a new account is selected. That will trigger a
# re-review.
log.info(u'[Webapp:%s] (Re-review) Public app, premium type '
u'upgraded.' % self.webapp)
RereviewQueue.flag(
self.webapp, mkt.LOG.REREVIEW_PREMIUM_TYPE_UPGRADE)
if (self.webapp.has_incomplete_status() and
self.webapp.is_fully_complete()):
_restore_app_status(self.webapp)
示例11: test_signals
def test_signals(self, mock):
RereviewQueue.flag(self.app, mkt.LOG.REREVIEW_PREMIUM_TYPE_UPGRADE)
assert mock.called
mock.reset()
RereviewQueue.objects.filter(addon=self.app).delete()
assert mock.called
示例12: test_flag_creates_notes
def test_flag_creates_notes(self):
RereviewQueue.flag(self.app, mkt.LOG.REREVIEW_PREMIUM_TYPE_UPGRADE)
eq_(self.app.threads.all()[0].notes.all()[0].note_type,
comm.REREVIEW_PREMIUM_TYPE_UPGRADE)
示例13: test_notify_failure_with_rereview
def test_notify_failure_with_rereview(self):
RereviewQueue.flag(self.addon, amo.LOG.REREVIEW_MANIFEST_CHANGE,
'This app is flagged!')
notify_developers_of_failure(self.addon, 'blah')
eq_(len(mail.outbox), 0)