Exemple #1
0
    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")
Exemple #2
0
    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')
Exemple #3
0
 def test_shuffle(self):
     ids = get_creatured_ids(self.category, 'en-US')
     eq_((ids[0],), self.en_us_locale)
Exemple #4
0
 def test_by_locale(self):
     eq_(set(get_creatured_ids(self.category, 'en-US')),
         set(self.no_locale + self.en_us_locale))
Exemple #5
0
 def test_by_category(self):
     eq_(set(get_creatured_ids(self.category, None)),
         set(self.no_locale))
Exemple #6
0
 def test_shuffle(self):
     ids = get_creatured_ids(self.category, 'en-US')
     eq_((ids[0], ), self.en_us_locale)
Exemple #7
0
 def test_by_locale(self):
     eq_(set(get_creatured_ids(self.category, 'en-US')),
         set(self.no_locale + self.en_us_locale))
Exemple #8
0
 def test_by_category(self):
     eq_(set(get_creatured_ids(self.category, None)), set(self.no_locale))
Exemple #9
0
 def test_shuffle(self):
     ids = get_creatured_ids(self.category, 'en-US')
     eq_(ids[0], 3481)
Exemple #10
0
 def test_by_locale(self):
     eq_(set(get_creatured_ids(self.category, 'en-US')), set([1001, 3481]))
Exemple #11
0
 def test_by_category(self):
     eq_(set(get_creatured_ids(self.category, None)), set([1001]))