From 5935113a64f55e623b4c15591e1651290112be61 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Fri, 26 Sep 2008 21:28:46 +0000 Subject: [PATCH] use sort(reverse=True). git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23855 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/AmortisationRule.py | 2 +- product/ERP5Form/PreferenceTool.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/product/ERP5/Document/AmortisationRule.py b/product/ERP5/Document/AmortisationRule.py index 1949c97c85..3dd390777a 100644 --- a/product/ERP5/Document/AmortisationRule.py +++ b/product/ERP5/Document/AmortisationRule.py @@ -677,7 +677,7 @@ class AmortisationRule(Rule): # We have each matching ratio. Now we need to match each amortisation period # according to these ratio : the highest ratio gets the priority, then the next # highest is taken into account if corresponding resources are free, and so on - matching_ratio_list.sort(key=lambda x: -x['ratio']) + matching_ratio_list.sort(key=lambda x: x['ratio'], reverse=True) calculated_to_match = calculated_period_dict.keys() aggregated_to_match = aggregated_period_dict.keys() match_dict = {} diff --git a/product/ERP5Form/PreferenceTool.py b/product/ERP5Form/PreferenceTool.py index 00b20293a7..b379529ee3 100644 --- a/product/ERP5Form/PreferenceTool.py +++ b/product/ERP5Form/PreferenceTool.py @@ -228,11 +228,11 @@ class PreferenceTool(BaseTool): prefs.append(pref) else : prefs.append(pref) - prefs.sort(key=lambda x: -x.getPriority()) + prefs.sort(key=lambda x: x.getPriority(), reverse=True) # add system preferences after user preferences sys_prefs = [x.getObject() for x in self.searchFolder(portal_type='System Preference', **kw) \ if x.getObject().getProperty('preference_state', 'broken') in ('enabled', 'global')] - sys_prefs.sort(key=lambda x: -x.getPriority()) + sys_prefs.sort(key=lambda x: x.getPriority(), reverse=True) return sys_prefs + prefs security.declareProtected(Permissions.View, 'getActivePreference') -- 2.30.9