[Moin-devel] [patch]Page.py,wikiutil.py - title2 should override <hr> after page trail

Roger Haase crosseyedpenguin at yahoo.com
Mon Dec 9 12:06:05 EST 2002


I submitted this patch a while back with a bug in it. 

When you override "title2" in moin_config.py and have the "Show page
trail" checked in UserPreferences, title2 overrides the <hr> before the
page trail, not the <hr> after the page trail.

The patch below moves the lines creating the page trail from Page.py to
wikiutil.py and makes a few minor code changes.  The horizontal rule
preceeding the page trail is eliminated and "title2" will override the
<hr> following the page trail (if the option is checked).

Per you comment on the SourceForge patch submission page, If you have
interest, I will add this to your project patch list.

Roger Haase


Index: Page.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/Page.py,v
retrieving revision 1.134
diff -u -r1.134 Page.py
--- Page.py	28 Nov 2002 19:50:21 -0000	1.134
+++ Page.py	9 Dec 2002 04:52:27 -0000
@@ -364,19 +364,19 @@
                     pagename=self.page_name, print_mode=print_mode,
                     allow_doubleclick=1)
 
-                # page trail?
-                if not print_mode and user.current.valid:
-                    user.current.addTrail(self.page_name)
-                    trail = user.current.getTrail()
-                    if trail and user.current.show_page_trail:
-                        delim = '>'
-                        if string.lower(config.charset) ==
'iso-8859-1':
-                            delim = '»'
-                        print '<font face="Verdana"
size="-1">%s %s %s</font><hr>' % (
-                            string.join(
-                                map(lambda p: Page(p).link_to(),
trail[:-1]),
-                                " %s " % delim),
-                            delim, cgi.escape(trail[-1]))
+                ## # page trail? -- moved to wikiutil 2002-11-22
+                ## if not print_mode and user.current.valid:
+                    ## user.current.addTrail(self.page_name)
+                    ## trail = user.current.getTrail()
+                    ## if trail and user.current.show_page_trail:
+                        ## delim = '>'
+                        ## if string.lower(config.charset) ==
'iso-8859-1':
+                            ## delim = '»'
+                        ## print '<font face="Verdana"
size="-1">%s %s %s</font><hr>' % (
+                            ## string.join(
+                                ## map(lambda p: Page(p).link_to(),
trail[:-1]),
+                                ## " %s " % delim),
+                            ## delim, cgi.escape(trail[-1]))
 
                 # user-defined form preview?
                 if pi_formtext:
Index: wikiutil.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/wikiutil.py,v
retrieving revision 1.119
diff -u -r1.119 wikiutil.py
--- wikiutil.py	5 Dec 2002 17:47:19 -0000	1.119
+++ wikiutil.py	9 Dec 2002 04:52:28 -0000
@@ -722,6 +722,22 @@
             'pagename': quoteWikiname(keywords['pagename'])}
         print '</div>'
 
+    # page trail? (moved from Page~line 351 with minor changes)
+    # print page trail only if caller explicitly passes keyword
print_mode=0
+    if not keywords.get('print_mode',1) and user.current.valid: 
+        user.current.addTrail(keywords['pagename'])
+        trail = user.current.getTrail()
+        if trail and user.current.show_page_trail:
+            delim = '>'
+            if string.lower(config.charset) == 'iso-8859-1':
+                delim = '»'
+            #print '<hr><font face="Verdana" size="-1">%s %s
%s</font>' % ( # <hr> unneeded
+            print '<font face="Verdana" size="-1">%s %s
%s</font>' % (
+                string.join(
+                    map(lambda p: Page(p).link_to(), trail[:-1]),
+                    " %s " % delim),
+                delim, cgi.escape(trail[-1]))
+
     # print custom html code after system title (normally "<hr>")
     _emit_custom_html(None, config.title2)
     # !!! _emit_custom_html(request, config.title2)


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




More information about the Moin-devel mailing list