launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25814
[Merge] ~cjwatson/launchpad:py3-translationimporter-sorted into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-translationimporter-sorted into launchpad:master.
Commit message:
Fix TranslationImporter.getTranslationFileFormat for Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394989
dict.values() returns an iterator, so use sorted() instead of .sort().
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-translationimporter-sorted into launchpad:master.
diff --git a/lib/lp/translations/utilities/translation_import.py b/lib/lp/translations/utilities/translation_import.py
index 600962a..f931b82 100644
--- a/lib/lp/translations/utilities/translation_import.py
+++ b/lib/lp/translations/utilities/translation_import.py
@@ -313,8 +313,8 @@ class TranslationImporter:
def getTranslationFileFormat(self, file_extension, file_contents):
"""See `ITranslationImporter`."""
- all_importers = importers.values()
- all_importers.sort(key=attrgetter('priority'), reverse=True)
+ all_importers = sorted(
+ importers.values(), key=attrgetter('priority'), reverse=True)
for importer in all_importers:
if file_extension in importer.file_extensions:
return importer.getFormat(file_contents)