From 9acae339ffefa1193b25e28efc3dc4c3533b7188 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 27 Nov 2010 14:56:15 -0600 Subject: 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 --- public/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/utils.py b/public/utils.py index 2801c93..81f589f 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) -- cgit v1.2.3-24-g4f1b