[Moin-user] [PATCH] support showing trail lists in reverse order

Tim Bird tim.bird at am.sony.com
Wed Jan 10 16:40:37 EST 2007

The attached patch adds an extra parameter to the "trail" function
in theme/__init__.py.  This allows a theme to specify that the
trail should be listed in reverse order.  I recently wrote a
theme where the page trail was put in a sidebar list, and it
made more sense (at least to me) to show the most recently visited
page in the trail at the top of the list instead of the bottom.

To use this feature in a theme, just add an extra "1" when
calling the trail function, like so:

trail = self.trail(d, 1)

The patch is below:

 -- Tim Bird, Senior Staff Engineer, Sony Electronics

--- MoinMoin.orig/theme/__init__.py	2006-06-29 11:54:44.000000000 -0700
+++ MoinMoin/theme/__init__.py	2006-11-30 17:32:43.000000000 -0800
@@ -495,7 +495,7 @@ class ThemeBase:

         return u'<div id="message">\n%s\n</div>\n' % html

-    def trail(self, d):
+    def trail(self, d, reverse=0):
         """ Assemble page trail

         @param d: parameter dictionary
@@ -531,6 +531,9 @@ class ThemeBase:
                     title = self.shortenPagename(title)
                     link = page.link_to(request, title)
                     items.append('<li>%s</li>' % link)
+		if reverse:
+		    items.reverse()
                 html = '''
 <ul id="pagetrail">

More information about the Moin-user mailing list