Commit 7f2db675 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

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


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23852 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5ae09a93
......@@ -59,7 +59,7 @@ log(\'Category_getSortedCategoryChildValueList\', \'use getCategoryChildValueLis
\n
value_list = filter(lambda o: o.getRelativeUrl() != context.getRelativeUrl(),context.getCategoryChildValueList())\n
sort_id=\'int_index\'\n
value_list.sort(lambda x,y: cmp(x.getProperty(sort_id), y.getProperty(sort_id)))\n
value_list.sort(key=lambda x: x.getProperty(sort_id))\n
return value_list\n
</string> </value>
</item>
......
......@@ -68,7 +68,7 @@ def getModuleItemList(user=None):\n
if portal.portal_membership.checkPermission(\'View\', module):\n
item_list.append((gettext(module.getTitleOrId()), module.absolute_url_path()))\n
\n
item_list.sort(lambda a, b:cmp(a[0], b[0]))\n
item_list.sort(key=lambda x: x[0])\n
return item_list\n
\n
getModuleItemList = CachingMethod(getModuleItemList, \n
......
......@@ -76,7 +76,7 @@ if hasattr(request, \'listbox\'):\n
keys_list = listbox.keys()\n
\n
if keys_list != []:\n
keys_list.sort(lambda x,y: cmp(int(x),int(y)))\n
keys_list.sort(key=lambda x: int(x))\n
first_empty_line_id = int(keys_list[-1])+1\n
\n
for i in keys_list:\n
......
......@@ -85,7 +85,7 @@ for cache_key,cache_key_memory in cache_plugin_stats_data.items():\n
# sort result\n
if kw.get(\'sort_on\', None) is not None:\n
sort_on_attr, sort_on_order = kw[\'sort_on\'][0]\n
result.sort(lambda x,y: cmp(int(getattr(x, sort_on_attr)), int(getattr(y, sort_on_attr))))\n
result.sort(key=lambda x: int(getattr(x, sort_on_attr)))\n
if sort_on_order == \'descending\':\n
result.reverse()\n
\n
......
968
\ No newline at end of file
969
\ No newline at end of file
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