Commit 6f854554 authored by Jérome Perrin's avatar Jérome Perrin

sort using key, not cmp

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30196 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dfe87eac
...@@ -53,14 +53,10 @@ ...@@ -53,14 +53,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>def sort_method(a, b):\n <value> <string>account_list = [a.getObject() for a in context.getPortalObject().account_module.searchFolder(\n
return cmp(a.Account_getFormattedTitle(),\n
b.Account_getFormattedTitle())\n
\n
account_list = [a.getObject() for a in context.getPortalObject().account_module.searchFolder(\n
validation_state=\'validated\')]\n validation_state=\'validated\')]\n
\n \n
account_list.sort(sort_method)\n account_list.sort(key=lambda account: account.Account_getFormattedTitle())\n
return account_list\n return account_list\n
</string> </value> </string> </value>
</item> </item>
...@@ -98,7 +94,6 @@ return account_list\n ...@@ -98,7 +94,6 @@ return account_list\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>sort_method</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
......
244 245
\ No newline at end of file \ 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