本文整理汇总了Python中mkt.reviewers.utils.device_queue_search函数的典型用法代码示例。如果您正苦于以下问题:Python device_queue_search函数的具体用法?Python device_queue_search怎么用?Python device_queue_search使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_queue_search函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: queue_counts
def queue_counts(request):
queues_helper = ReviewersQueuesHelper()
counts = {
'pending': queues_helper.get_pending_queue().count(),
'rereview': queues_helper.get_rereview_queue().count(),
'updates': queues_helper.get_updates_queue().count(),
'escalated': queues_helper.get_escalated_queue().count(),
'moderated': queues_helper.get_moderated_queue().count(),
'region_cn': Webapp.objects.pending_in_region(mkt.regions.CN).count(),
'additional_tarako': (
AdditionalReview.objects
.unreviewed(queue=QUEUE_TARAKO, and_approved=True)
.count()),
}
if 'pro' in request.GET:
counts.update({'device': device_queue_search(request).count()})
rv = {}
if isinstance(type, basestring):
return counts[type]
for k, v in counts.items():
if not isinstance(type, list) or k in type:
rv[k] = v
return rv
示例2: queue_counts
def queue_counts(request):
excluded_ids = EscalationQueue.objects.no_cache().values_list('addon',
flat=True)
public_statuses = amo.WEBAPPS_APPROVED_STATUSES
counts = {
'pending': Webapp.objects.no_cache()
.exclude(id__in=excluded_ids)
.filter(type=amo.ADDON_WEBAPP,
disabled_by_user=False,
status=amo.STATUS_PENDING)
.count(),
'rereview': RereviewQueue.objects.no_cache()
.exclude(addon__in=excluded_ids)
.filter(addon__disabled_by_user=False)
.count(),
# This will work as long as we disable files of existing unreviewed
# versions when a new version is uploaded.
'updates': File.objects.no_cache()
.exclude(version__addon__id__in=excluded_ids)
.filter(version__addon__type=amo.ADDON_WEBAPP,
version__addon__disabled_by_user=False,
version__addon__is_packaged=True,
version__addon__status__in=public_statuses,
version__deleted=False,
status=amo.STATUS_PENDING)
.count(),
'escalated': EscalationQueue.objects.no_cache()
.filter(addon__disabled_by_user=False)
.count(),
'moderated': Review.objects.no_cache().filter(
addon__type=amo.ADDON_WEBAPP,
reviewflag__isnull=False,
editorreview=True)
.count(),
'themes': Persona.objects.no_cache()
.filter(addon__status=amo.STATUS_PENDING)
.count(),
}
if acl.action_allowed(request, 'SeniorPersonasTools', 'View'):
counts.update({
'flagged_themes': (Persona.objects.no_cache()
.filter(addon__status=amo.STATUS_REVIEW_PENDING)
.count()),
'rereview_themes': RereviewQueueTheme.objects.count()
})
if waffle.switch_is_active('buchets') and 'pro' in request.GET:
counts.update({'device': device_queue_search(request).count()})
rv = {}
if isinstance(type, basestring):
return counts[type]
for k, v in counts.items():
if not isinstance(type, list) or k in type:
rv[k] = v
return rv
示例3: queue_tabnav
def queue_tabnav(context):
"""
Returns tuple of tab navigation for the queue pages.
Each tuple contains three elements: (url, tab_code, tab_text)
"""
request = context['request']
counts = context['queue_counts']
apps_reviewing = AppsReviewing(request).get_apps()
# Apps.
if acl.action_allowed(request, 'Apps', 'Review'):
rv = [
(reverse('reviewers.apps.queue_pending'), 'pending',
_('Apps ({0})', counts['pending']).format(counts['pending'])),
(reverse('reviewers.apps.queue_rereview'), 'rereview',
_('Re-reviews ({0})', counts['rereview']).format(
counts['rereview'])),
(reverse('reviewers.apps.queue_updates'), 'updates',
_('Updates ({0})', counts['updates']).format(counts['updates'])),
]
if acl.action_allowed(request, 'Apps', 'ReviewEscalated'):
rv.append((reverse('reviewers.apps.queue_escalated'), 'escalated',
_('Escalations ({0})', counts['escalated']).format(
counts['escalated'])))
rv.extend([
(reverse('reviewers.apps.queue_moderated'), 'moderated',
_('Moderated Reviews ({0})', counts['moderated'])
.format(counts['moderated'])),
(reverse('reviewers.apps.apps_reviewing'), 'reviewing',
_('Reviewing ({0})').format(len(apps_reviewing))),
])
if acl.action_allowed(request, 'Apps', 'ReviewRegionCN'):
url_ = reverse('reviewers.apps.queue_region',
args=[mkt.regions.CN.slug])
rv.append((url_, 'region',
_('China ({0})').format(counts['region_cn'])))
if acl.action_allowed(request, 'Apps', 'ReviewTarako'):
url_ = reverse('reviewers.apps.additional_review',
args=[QUEUE_TARAKO])
rv.append((url_, 'additional',
_('Tarako ({0})').format(counts['additional_tarako'])))
else:
rv = []
if 'pro' in request.GET:
device_srch = device_queue_search(request)
rv.append((reverse('reviewers.apps.queue_device'), 'device',
_('Device ({0})').format(device_srch.count()),))
return rv
示例4: queue_device
def queue_device(request):
"""
A device specific queue matching apps which require features that our
device support based on the `profile` query string.
"""
if waffle.switch_is_active("buchets") and "pro" in request.GET:
apps = [QueuedApp(app, app.all_versions[0].nomination) for app in device_queue_search(request)]
else:
apps = []
return _queue(request, apps, "device")
示例5: queue_counts
def queue_counts(request):
excluded_ids = EscalationQueue.objects.no_cache().values_list('addon',
flat=True)
public_statuses = amo.WEBAPPS_APPROVED_STATUSES
counts = {
'pending': Webapp.objects.no_cache()
.exclude(id__in=excluded_ids)
.filter(type=amo.ADDON_WEBAPP,
disabled_by_user=False,
status=amo.STATUS_PENDING)
.count(),
'rereview': RereviewQueue.objects.no_cache()
.exclude(addon__in=excluded_ids)
.filter(addon__disabled_by_user=False)
.count(),
# This will work as long as we disable files of existing unreviewed
# versions when a new version is uploaded.
'updates': File.objects.no_cache()
.exclude(version__addon__id__in=excluded_ids)
.filter(version__addon__type=amo.ADDON_WEBAPP,
version__addon__disabled_by_user=False,
version__addon__is_packaged=True,
version__addon__status__in=public_statuses,
version__deleted=False,
status=amo.STATUS_PENDING)
.count(),
'escalated': EscalationQueue.objects.no_cache()
.filter(addon__disabled_by_user=False)
.count(),
'moderated': Review.objects.no_cache()
.exclude(Q(addon__isnull=True) |
Q(reviewflag__isnull=True))
.exclude(addon__status=amo.STATUS_DELETED)
.filter(addon__type=amo.ADDON_WEBAPP,
editorreview=True)
.count(),
'region_cn': Webapp.objects.pending_in_region(mkt.regions.CN).count(),
'additional_tarako': (
AdditionalReview.objects
.unreviewed(queue=QUEUE_TARAKO)
.count()),
}
if 'pro' in request.GET:
counts.update({'device': device_queue_search(request).count()})
rv = {}
if isinstance(type, basestring):
return counts[type]
for k, v in counts.items():
if not isinstance(type, list) or k in type:
rv[k] = v
return rv
示例6: queue_device
def queue_device(request):
"""
A device specific queue matching apps which require features that our
device support based on the `profile` query string.
"""
if 'pro' in request.GET:
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in device_queue_search(request)]
else:
apps = []
return _queue(request, apps, 'device')
示例7: queue_tabnav
def queue_tabnav(context):
"""
Returns tuple of tab navigation for the queue pages.
Each tuple contains three elements: (named_url. tab_code, tab_text)
"""
request = context['request']
counts = context['queue_counts']
apps_reviewing = AppsReviewing(request).get_apps()
# Apps.
if acl.action_allowed(request, 'Apps', 'Review'):
rv = [
('reviewers.apps.queue_pending', 'pending',
_('Apps ({0})', counts['pending']).format(counts['pending'])),
('reviewers.apps.queue_rereview', 'rereview',
_('Re-reviews ({0})', counts['rereview']).format(
counts['rereview'])),
('reviewers.apps.queue_updates', 'updates',
_('Updates ({0})', counts['updates']).format(counts['updates'])),
]
if acl.action_allowed(request, 'Apps', 'ReviewEscalated'):
rv.append(('reviewers.apps.queue_escalated', 'escalated',
_('Escalations ({0})', counts['escalated']).format(
counts['escalated'])))
rv.extend([
('reviewers.apps.queue_moderated', 'moderated',
_('Moderated Reviews ({0})', counts['moderated'])
.format(counts['moderated'])),
('reviewers.apps.apps_reviewing', 'reviewing',
_('Reviewing ({0})').format(len(apps_reviewing))),
])
else:
rv = []
# Themes.
if (acl.action_allowed(request, 'Personas', 'Review') and
waffle.switch_is_active('mkt-themes')):
rv.append(('reviewers.themes.list', 'themes',
_('Themes ({0})').format(counts['themes']),))
if waffle.switch_is_active('buchets') and 'pro' in request.GET:
device_srch = device_queue_search(request)
rv.append(('reviewers.apps.queue_device', 'device',
_('Device ({0})').format(device_srch.count()),))
return rv
示例8: queue_counts
def queue_counts(request):
excluded_ids = EscalationQueue.uncached.values_list("addon", flat=True)
public_statuses = amo.WEBAPPS_APPROVED_STATUSES
counts = {
"pending": Webapp.uncached.exclude(id__in=excluded_ids)
.filter(type=amo.ADDON_WEBAPP, disabled_by_user=False, status=amo.STATUS_PENDING)
.count(),
"rereview": RereviewQueue.uncached.exclude(addon__in=excluded_ids)
.filter(addon__disabled_by_user=False)
.count(),
# This will work as long as we disable files of existing unreviewed
# versions when a new version is uploaded.
"updates": File.uncached.exclude(version__addon__id__in=excluded_ids)
.filter(
version__addon__type=amo.ADDON_WEBAPP,
version__addon__disabled_by_user=False,
version__addon__is_packaged=True,
version__addon__status__in=public_statuses,
version__deleted=False,
status=amo.STATUS_PENDING,
)
.count(),
"escalated": EscalationQueue.uncached.filter(addon__disabled_by_user=False).count(),
"moderated": Review.uncached.filter(
addon__type=amo.ADDON_WEBAPP, reviewflag__isnull=False, editorreview=True
).count(),
"themes": Persona.objects.no_cache().filter(addon__status=amo.STATUS_PENDING).count(),
}
if waffle.switch_is_active("buchets") and "pro" in request.GET:
counts.update({"device": device_queue_search(request).count()})
rv = {}
if isinstance(type, basestring):
return counts[type]
for k, v in counts.items():
if not isinstance(type, list) or k in type:
rv[k] = v
return rv
示例9: queue_tabnav
def queue_tabnav(context):
"""
Returns tuple of tab navigation for the queue pages.
Each tuple contains three elements: (url, tab_code, tab_text)
"""
request = context["request"]
counts = context["queue_counts"]
apps_reviewing = AppsReviewing(request).get_apps()
# Apps.
if acl.action_allowed(request, "Apps", "Review"):
rv = [
(
reverse("reviewers.apps.queue_pending"),
"pending",
_("Apps ({0})", counts["pending"]).format(counts["pending"]),
),
(
reverse("reviewers.apps.queue_rereview"),
"rereview",
_("Re-reviews ({0})", counts["rereview"]).format(counts["rereview"]),
),
(
reverse("reviewers.apps.queue_updates"),
"updates",
_("Updates ({0})", counts["updates"]).format(counts["updates"]),
),
]
if acl.action_allowed(request, "Apps", "ReviewEscalated"):
rv.append(
(
reverse("reviewers.apps.queue_escalated"),
"escalated",
_("Escalations ({0})", counts["escalated"]).format(counts["escalated"]),
)
)
rv.extend(
[
(
reverse("reviewers.apps.queue_moderated"),
"moderated",
_("Moderated Reviews ({0})", counts["moderated"]).format(counts["moderated"]),
),
(
reverse("reviewers.apps.apps_reviewing"),
"reviewing",
_("Reviewing ({0})").format(len(apps_reviewing)),
),
]
)
if acl.action_allowed(request, "Apps", "ReviewRegionCN"):
url_ = reverse("reviewers.apps.queue_region", args=[mkt.regions.CN.slug])
rv.append((url_, "region", _("China ({0})").format(counts["region_cn"])))
else:
rv = []
if "pro" in request.GET:
device_srch = device_queue_search(request)
rv.append((reverse("reviewers.apps.queue_device"), "device", _("Device ({0})").format(device_srch.count())))
return rv