Commit 1ed9078b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use key instead of cmp in sort() for better performance.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29751 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bcedc66e
......@@ -427,11 +427,7 @@ class ERP5Site(FolderMixIn, CMFSite):
if group in getattr(pt, 'group_list', ()):
type_list.append(pt.getId())
def sortByTranslation(a, b):
return cmp(localizer_tool.translate('ui', a),
localizer_tool.translate('ui', b))
type_list.sort(sortByTranslation)
type_list.sort(key=lambda x:localizer_tool.translate('ui', x))
return tuple(type_list)
localizer_tool = getToolByName(self, 'Localizer')
......
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