Commit 5935113a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use sort(reverse=True).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23855 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f83794f9
...@@ -677,7 +677,7 @@ class AmortisationRule(Rule): ...@@ -677,7 +677,7 @@ class AmortisationRule(Rule):
# We have each matching ratio. Now we need to match each amortisation period # 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 # 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 # 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() calculated_to_match = calculated_period_dict.keys()
aggregated_to_match = aggregated_period_dict.keys() aggregated_to_match = aggregated_period_dict.keys()
match_dict = {} match_dict = {}
......
...@@ -228,11 +228,11 @@ class PreferenceTool(BaseTool): ...@@ -228,11 +228,11 @@ class PreferenceTool(BaseTool):
prefs.append(pref) prefs.append(pref)
else : else :
prefs.append(pref) 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 # add system preferences after user preferences
sys_prefs = [x.getObject() for x in self.searchFolder(portal_type='System Preference', **kw) \ sys_prefs = [x.getObject() for x in self.searchFolder(portal_type='System Preference', **kw) \
if x.getObject().getProperty('preference_state', 'broken') in ('enabled', 'global')] 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 return sys_prefs + prefs
security.declareProtected(Permissions.View, 'getActivePreference') security.declareProtected(Permissions.View, 'getActivePreference')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment