changeset 95:15629036f800

frontend/views: output of index and global_index sorted. optional it can be reverse sorted.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 07 Mar 2011 21:03:35 +0100
parents 990fdbe2d52c
children eef6676def4d
files MoinMoin/apps/frontend/views.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Mon Mar 07 21:00:33 2011 +0100
+++ b/MoinMoin/apps/frontend/views.py	Mon Mar 07 21:03:35 2011 +0100
@@ -1,4 +1,5 @@
 # Copyright: 2003-2010 MoinMoin:ThomasWaldmann
+# Copyright: 2011 MoinMoin:ReimarBauer
 # Copyright: 2008 MoinMoin:FlorianKrupicka
 # Copyright: 2010 MoinMoin:DiogenesAugusto
 # Copyright: 2001 Richard Jones <richard@bizarsoftware.com.au>
@@ -469,6 +470,10 @@
     except AccessDeniedError:
         abort(403)
     index = item.flat_index()
+    reverse = request.values.get('reverse', False)
+    index.sort()
+    if reverse:
+        index.reverse()
     return render_template(item.index_template,
                            item=item, item_name=item_name,
                            index=index,
@@ -479,6 +484,10 @@
 def global_index():
     item = Item.create('') # XXX hack: item_name='' gives toplevel index
     index = item.flat_index()
+    index.sort()
+    reverse = request.values.get('reverse', False)
+    if reverse:
+        index.reverse()
     item_name = request.values.get('item_name', '') # actions menu puts it into qs
     return render_template('global_index.html',
                            item_name=item_name, # XXX no item