diff options
author | Dan McGee <dan@archlinux.org> | 2010-11-27 14:56:15 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-11-27 14:56:15 -0600 |
commit | 9acae339ffefa1193b25e28efc3dc4c3533b7188 (patch) | |
tree | eb2d34f31624c8bacc41532d8a92eab3b4693c9a /public | |
parent | 21c48f9fbcdc6c42d664a09bda85285cbc7d72ec (diff) |
Simplify sorting attrgetter calls
Don't use dotted notation now that we have less-than implemented methods
on the respective objects (which also allows this code to work under
PyPy). Switch a lambda call to use attrgetter as well.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'public')
-rw-r--r-- | public/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/public/utils.py b/public/utils.py index 2801c939..81f589f7 100644 --- a/public/utils.py +++ b/public/utils.py @@ -13,7 +13,7 @@ def get_recent_updates(): # grab a few extra so we can hopefully catch everything we need pkgs += list(Package.objects.select_related( 'arch', 'repo').filter(arch=arch).order_by('-last_update')[:50]) - pkgs.sort(key=lambda q: q.last_update) + pkgs.sort(key=attrgetter('last_update')) updates = [] ctr = 0 while ctr < 15 and len(pkgs) > 0: @@ -22,7 +22,7 @@ def get_recent_updates(): is_same = lambda q: p.is_same_version(q) and p.repo == q.repo samepkgs = filter(is_same, pkgs) samepkgs.append(p) - samepkgs.sort(key=attrgetter('arch.name')) + samepkgs.sort(key=attrgetter('arch')) updates.append(samepkgs) for q in samepkgs: if p != q: pkgs.remove(q) |