Commit 169c5ea6 authored by Jérome Perrin's avatar Jérome Perrin

sort sections in popup menus

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29180 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6c0c6725
...@@ -75,7 +75,12 @@ current_destination_section = context.getDestinationSectionValue()\n ...@@ -75,7 +75,12 @@ current_destination_section = context.getDestinationSectionValue()\n
if current_destination_section is not None and current_destination_section not in result:\n if current_destination_section is not None and current_destination_section not in result:\n
result.append(current_destination_section)\n result.append(current_destination_section)\n
\n \n
return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n def sorted(seq, key):\n
seq = seq[::]\n
seq.sort(key=key)\n
return seq\n
\n
return [(\'\', \'\')] + sorted([(i.getTitle(), i.getRelativeUrl()) for i in result], key=lambda x:x[0])\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -123,6 +128,7 @@ return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n ...@@ -123,6 +128,7 @@ return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n
<string>_getiter_</string> <string>_getiter_</string>
<string>r</string> <string>r</string>
<string>current_destination_section</string> <string>current_destination_section</string>
<string>sorted</string>
<string>i</string> <string>i</string>
</tuple> </tuple>
</value> </value>
......
...@@ -74,8 +74,13 @@ current_source_section = context.getSourceSectionValue()\n ...@@ -74,8 +74,13 @@ current_source_section = context.getSourceSectionValue()\n
if current_source_section is not None and current_source_section not in result:\n if current_source_section is not None and current_source_section not in result:\n
result.append(current_source_section)\n result.append(current_source_section)\n
\n \n
def sorted(seq, key):\n
seq = seq[::]\n
seq.sort(key=key)\n
return seq\n
\n
# convert to ListField format\n # convert to ListField format\n
return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n return [(\'\', \'\')] + sorted([(i.getTitle(), i.getRelativeUrl()) for i in result], key=lambda x:x[0])\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -123,6 +128,7 @@ return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n ...@@ -123,6 +128,7 @@ return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n
<string>_getiter_</string> <string>_getiter_</string>
<string>r</string> <string>r</string>
<string>current_source_section</string> <string>current_source_section</string>
<string>sorted</string>
<string>i</string> <string>i</string>
</tuple> </tuple>
</value> </value>
......
970 971
\ 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