def filter_featured(self): # Featured search add-ons in all locales: APP, LANG = self.request.APP, self.request.LANG ids = get_featured_ids(APP, LANG, amo.ADDON_SEARCH) try: search_cat = Category.objects.get(slug="search-tools", application=APP.id) others = get_creatured_ids(search_cat, LANG) ids.extend(o for o in others if o not in ids) except Category.DoesNotExist: pass return manual_order(Addon.objects.valid(), ids, "addons.id")
def filter_featured(self): # Featured search add-ons in all locales: APP, LANG = self.request.APP, self.request.LANG ids = get_featured_ids(APP, LANG, amo.ADDON_SEARCH) try: search_cat = Category.objects.get(slug='search-tools', application=APP.id) others = get_creatured_ids(search_cat, LANG) ids.extend(o for o in others if o not in ids) except Category.DoesNotExist: pass return manual_order(Addon.objects.valid(), ids, 'addons.id')
def test_shuffle(self): ids = get_creatured_ids(self.category, 'en-US') eq_((ids[0],), self.en_us_locale)
def test_by_locale(self): eq_(set(get_creatured_ids(self.category, 'en-US')), set(self.no_locale + self.en_us_locale))
def test_by_category(self): eq_(set(get_creatured_ids(self.category, None)), set(self.no_locale))
def test_shuffle(self): ids = get_creatured_ids(self.category, 'en-US') eq_((ids[0], ), self.en_us_locale)
def test_shuffle(self): ids = get_creatured_ids(self.category, 'en-US') eq_(ids[0], 3481)
def test_by_locale(self): eq_(set(get_creatured_ids(self.category, 'en-US')), set([1001, 3481]))
def test_by_category(self): eq_(set(get_creatured_ids(self.category, None)), set([1001]))