Fix sort comparison function

In python3 you can't use a cmp function and have to use a key function
when sorting. Python2 supports both so we switch to a key function that
takes a single arg in the sort of supported languages in the pasting
script.

Change-Id: Ib49bcb22653bd577078a386750027fc5acee3180
This commit is contained in:
Clark Boylan 2020-03-05 12:09:03 -08:00
parent 9b854e7729
commit 18a2ac5b21
1 changed files with 1 additions and 3 deletions

View File

@ -186,9 +186,7 @@ def print_languages():
"""Print a list of all supported languages, with description."""
xmlrpc = get_xmlrpc_service()
languages = xmlrpc.pastes.getLanguages().items()
languages.sort(
lambda a, b: (a[1].lower() > b[1].lower())-(a[1].lower() < b[1].lower())
)
languages.sort(key=lambda a: a[1].lower())
print('Supported Languages:')
for alias, name in languages:
print(' %-30s%s' % (alias, name))