本文整理汇总了Python中editors.models.RereviewQueue类的典型用法代码示例。如果您正苦于以下问题:Python RereviewQueue类的具体用法?Python RereviewQueue怎么用?Python RereviewQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RereviewQueue类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_manifest
def _update_manifest(id, check_hash, failed_fetches):
webapp = Webapp.objects.get(pk=id)
version = webapp.versions.latest()
file_ = version.files.latest()
_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)
failed_fetches[id] = failed_fetches.get(id, 0) + 1
if failed_fetches[id] >= 3:
_log(webapp, msg, rereview=True, exc_info=True)
if webapp.status in amo.WEBAPPS_APPROVED_STATUSES:
RereviewQueue.flag(webapp, amo.LOG.REREVIEW_MANIFEST_CHANGE,
msg)
del failed_fetches[id]
else:
_log(webapp, msg, rereview=False, exc_info=True)
return
示例2: _update_manifest
def _update_manifest(id, check_hash, failed_fetches):
webapp = Webapp.objects.get(pk=id)
version = webapp.versions.latest()
file_ = version.files.latest()
_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)
failed_fetches[id] = failed_fetches.get(id, 0) + 1
if failed_fetches[id] == 3:
# This is our 3rd attempt, let's send the developer(s) an email to
# notify him of the failures.
notify_developers_of_failure(webapp, u'Validation errors:\n' + msg)
elif failed_fetches[id] >= 4:
# This is our 4th attempt, we should already have notified the
# developer(s). Let's put the app in the re-review queue.
_log(webapp, msg, rereview=True, exc_info=True)
if webapp.status in amo.WEBAPPS_APPROVED_STATUSES:
RereviewQueue.flag(webapp, amo.LOG.REREVIEW_MANIFEST_CHANGE,
msg)
del failed_fetches[id]
else:
_log(webapp, msg, rereview=False, exc_info=True)
return
示例3: save
def save(self):
if self.cleaned_data.get("accounts"):
try:
log.info("[[email protected]%s] Deleting app payment account" % self.addon.pk)
AddonPaymentAccount.objects.get(addon=self.addon).delete()
except AddonPaymentAccount.DoesNotExist:
pass
log.info("[[email protected]%s] Creating new app payment account" % self.addon.pk)
AddonPaymentAccount.create(
provider="bango", addon=self.addon, payment_account=self.cleaned_data["accounts"]
)
# 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.addon.status == amo.STATUS_NULL and self.addon.highest_status == amo.STATUS_PUBLIC:
# 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.addon)
RereviewQueue.flag(self.addon, amo.LOG.REREVIEW_PREMIUM_TYPE_UPGRADE)
_restore_app(self.addon)
示例4: 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)
示例5: mark_for_rereview_form_factors
def mark_for_rereview_form_factors(addon, added, removed):
msg = _(u'Form Factor(s) changed: {0}').format(', '.join(
[_(u'Added {0}').format(unicode(mkt.FORM_FACTOR_CHOICES[f].name))
for f in added] +
[_(u'Removed {0}').format(unicode(mkt.FORM_FACTOR_CHOICES[f].name))
for f in removed]))
RereviewQueue.flag(addon, amo.LOG.REREVIEW_FORM_FACTORS_ADDED, msg)
示例6: mark_for_rereview
def mark_for_rereview(addon, added_platforms, removed_platforms):
msg = _(u'Platform(s) changed: {0}').format(', '.join(
[_(u'Added {0}').format(unicode(mkt.PLATFORM_TYPES[p].name))
for p in added_platforms] +
[_(u'Removed {0}').format(unicode(mkt.PLATFORM_TYPES[p].name))
for p in removed_platforms]))
RereviewQueue.flag(addon, amo.LOG.REREVIEW_PLATFORMS_ADDED, msg)
示例7: _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.'))
示例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):
new_types = self.cleaned_data['device_types']
old_types = [x.id for x in addon.device_types]
added_devices = set(new_types) - set(old_types)
removed_devices = set(old_types) - set(new_types)
for d in added_devices:
AddonDeviceType(addon=addon, device_type=d).save()
for d in removed_devices:
AddonDeviceType.objects.filter(
addon=addon, device_type=d).delete()
# Send app to re-review queue if public and new devices are added.
if added_devices and self.addon.status == amo.STATUS_PUBLIC:
msg = _(u'Device(s) changed: %s' % (
', '.join([u'Added %s' % unicode(amo.DEVICE_TYPES[d].name)
for d in added_devices] +
[u'Removed %s' % unicode(amo.DEVICE_TYPES[d].name)
for d in removed_devices])))
RereviewQueue.flag(self.addon, amo.LOG.REREVIEW_DEVICES_ADDED, msg)
示例10: save
def save(self):
if self.cleaned_data.get('accounts'):
try:
log.info('[[email protected]%s] Deleting app payment account' % self.addon.pk)
AddonPaymentAccount.objects.get(
addon=self.addon,
payment_account__provider=self.provider.provider
).delete()
except AddonPaymentAccount.DoesNotExist:
pass
log.info('[[email protected]%s] Creating new app payment account' % self.addon.pk)
account = self.cleaned_data['accounts']
uri = self.provider.product_create(account, self.addon)
AddonPaymentAccount.objects.create(
addon=self.addon, 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.addon.status == amo.STATUS_NULL and
self.addon.highest_status in amo.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.addon)
RereviewQueue.flag(
self.addon, amo.LOG.REREVIEW_PREMIUM_TYPE_UPGRADE)
if (self.addon.has_incomplete_status() and
self.addon.is_fully_complete()):
_restore_app_status(self.addon)
示例11: _update_manifest
def _update_manifest(id, check_hash, failed_fetches):
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)
failed_fetches[id] = failed_fetches.get(id, 0) + 1
if failed_fetches[id] >= 3:
_log(webapp, msg, rereview=True, exc_info=True)
RereviewQueue.flag(webapp, amo.LOG.REREVIEW_MANIFEST_CHANGE, msg)
del failed_fetches[id]
else:
_log(webapp, msg, rereview=False, exc_info=True)
return
示例12: absolutify
upload = FileUpload.objects.get(pk=upload.pk)
if upload.validation:
v8n = json.loads(upload.validation)
if v8n['errors']:
v8n_url = absolutify(reverse(
'mkt.developers.upload_detail', args=[upload.uuid]))
msg = u'Validation errors:\n'
for m in v8n['messages']:
if m['type'] == u'error':
msg += u'* %s\n' % m['message']
msg += u'\nValidation Result:\n%s' % v8n_url
_log(webapp, msg, rereview=True)
if webapp.status in amo.WEBAPPS_APPROVED_STATUSES:
notify_developers_of_failure(webapp, msg, has_link=True)
RereviewQueue.flag(webapp, amo.LOG.REREVIEW_MANIFEST_CHANGE,
msg)
return
else:
_log(webapp,
u'Validation for upload UUID %s has no result' % upload.uuid)
# Get the old manifest before we overwrite it.
new = json.loads(content)
old = webapp.get_manifest_json(file_)
# New manifest is different and validates, update version/file.
try:
webapp.manifest_updated(content, upload)
except:
_log(webapp, u'Failed to create version', exc_info=True)
示例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)
示例14: mark_for_rereview_features_change
def mark_for_rereview_features_change(addon, 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(addon, amo.LOG.REREVIEW_FEATURES_CHANGED, msg)