diff --git a/apps/browse/tests.py b/apps/browse/tests.py index ab9ce49054..3e7cb5771d 100644 --- a/apps/browse/tests.py +++ b/apps/browse/tests.py @@ -64,7 +64,7 @@ class TestLanguageTools(amo.test_utils.ExtraSetup, test_utils.TestCase): def test_packs_and_dicts(self): ca = dict(self.locales)['ca-valencia'] eq_(len(ca.dicts), 1) - eq_(len(ca.packs), 2) + eq_(len(ca.packs), 3) def test_empty_target_locale(self): """Make sure nothing breaks with empty target locales.""" diff --git a/apps/browse/views.py b/apps/browse/views.py index 6b1c3c9188..7324f9a020 100644 --- a/apps/browse/views.py +++ b/apps/browse/views.py @@ -70,7 +70,7 @@ def _get_locales(addons): 'locale_disambiguation': addon.locale_disambiguation} locales = {} - for locale, addons in itertools.groupby(addons, lambda x: x.target_locale): + for locale, addons in amo.utils.sorted_groupby(addons, 'target_locale'): addons = list(addons) dicts = [slim(a) for a in addons if a.type == amo.ADDON_DICT] packs = [slim(a) for a in addons if a.type == amo.ADDON_LPAPP]