예제 #1
0
파일: views.py 프로젝트: almet/zamboni
    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")
예제 #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')
예제 #3
0
 def test_shuffle(self):
     ids = get_creatured_ids(self.category, 'en-US')
     eq_((ids[0],), self.en_us_locale)
예제 #4
0
 def test_by_locale(self):
     eq_(set(get_creatured_ids(self.category, 'en-US')),
         set(self.no_locale + self.en_us_locale))
예제 #5
0
 def test_by_category(self):
     eq_(set(get_creatured_ids(self.category, None)),
         set(self.no_locale))
예제 #6
0
 def test_shuffle(self):
     ids = get_creatured_ids(self.category, 'en-US')
     eq_((ids[0], ), self.en_us_locale)
예제 #7
0
 def test_by_locale(self):
     eq_(set(get_creatured_ids(self.category, 'en-US')),
         set(self.no_locale + self.en_us_locale))
예제 #8
0
 def test_by_category(self):
     eq_(set(get_creatured_ids(self.category, None)), set(self.no_locale))
예제 #9
0
 def test_shuffle(self):
     ids = get_creatured_ids(self.category, 'en-US')
     eq_(ids[0], 3481)
예제 #10
0
 def test_by_locale(self):
     eq_(set(get_creatured_ids(self.category, 'en-US')), set([1001, 3481]))
예제 #11
0
 def test_by_category(self):
     eq_(set(get_creatured_ids(self.category, None)), set([1001]))