flake8
passed.
JSHint
passed.
Review Request #9665 — Created Feb. 18, 2018 and submitted
Python 3 got rid of
cmp()
and related functionality, which broke two
sorting-related bits of code: One for sorting image srcsets, and one for
sorting entries inLocalDataQuerySet
.The image srcsets was easily converted to using sort keys, which is
preferred in Python 3 and is a bit faster than having a sorting
function.LocalDataQuerySet
needs a more advanced comparison function,
so is now usingfunctools.cmp_to_key()
, which enables usage of our
sorting function by implementing a key-like wrapper that calls into it
for value calculation.
Unit tests pass on Python 2.7. We're not in position to test on Python 3
yet, though.