changeset 1354:26949e36ca0b

move code for title_link to theme, better escape warning
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 Aug 2006 19:08:49 +0200
parents 36dec228a83f
children a796d366f176
files MoinMoin/Page.py MoinMoin/theme/__init__.py docs/CHANGES
diffstat 3 files changed, 21 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun Aug 20 17:00:17 2006 +0200
+++ b/MoinMoin/Page.py	Sun Aug 20 19:08:49 2006 +0200
@@ -872,9 +872,9 @@
             # New code should call with escape=0 to prevent the warning.
             if escape:
                 import warnings
-                warnings.warn("In moin 2.0 query string in url will not be"
-                              " escaped. See"
-                              " http://moinmoin.wikiwikiweb.de/ApiChanges")
+                warnings.warn("In moin 2.0 query string in url will not be escaped. "
+                              "See http://moinmoin.wikiwikiweb.de/ApiChanges. "
+                              "%s" % querystr)
                 querystr = wikiutil.escape(querystr)
 
             # make action URLs denyable by robots.txt:
@@ -1209,14 +1209,6 @@
 
             # send the page header
             if self.default_formatter:
-                querydict = {
-                    'action': 'fullsearch',
-                    'value': 'linkto:"%s"' % self.page_name,
-                    'context' : '180',
-                }
-                link = self.url(request, querydict)
-
-                title = self.split_title(request)
                 if self.rev:
                     msg = "<strong>%s</strong><br>%s" % (
                         _('Revision %(rev)d as of %(date)s') % {
@@ -1243,7 +1235,9 @@
                     request.user.addTrail(self.page_name)
                     trail = request.user.getTrail()
 
-                request.theme.send_title(title,  page=self, link=link, msg=msg,
+                title = self.split_title(request)
+
+                request.theme.send_title(title,  page=self, msg=msg,
                                     pagename=self.page_name, print_mode=print_mode,
                                     media=media, pi_refresh=pi_refresh,
                                     allow_doubleclick=1, trail=trail,
--- a/MoinMoin/theme/__init__.py	Sun Aug 20 17:00:17 2006 +0200
+++ b/MoinMoin/theme/__init__.py	Sun Aug 20 19:08:49 2006 +0200
@@ -213,19 +213,23 @@
         """
         _ = self.request.getText
         content = []
-        if d['title_link']: # having a link means we have a (linked) pagename ONLY as title, not a message title
-                            # XXX this method is rather ugly and should be improved
+        if d['title_text'] == d['page_name']: # just showing a page, no action
             curpage = ''
             segments = d['page_name'].split('/') # was: title_text
             for s in segments[:-1]:
                 curpage += s
                 content.append("<li>%s</li>" % Page(self.request, curpage).link_to(self.request, s))
                 curpage += '/'
-            content.append(('<li><a class="backlink" title="%(title)s" rel="nofollow" href="%(href)s">%(text)s</a></li>') % {
-                'title': _('Click to do a full-text search for this title'),
-                'href': d['title_link'],
-                'text': wikiutil.escape(segments[-1]),
-                })
+            link_text = segments[-1]
+            link_title = _('Click to do a full-text search for this title')
+            link_query = {
+                'action': 'fullsearch',
+                'value': 'linkto:"%s"' % d['page_name'],
+                'context': '180',
+            }
+            # we dont use d['title_link'] any more, but make it ourselves:
+            link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
+            content.append(('<li>%s</li>') % link)
         else:
             content.append('<li>%s</li>' % wikiutil.escape(d['title_text']))
 
@@ -1421,7 +1425,6 @@
         current page being rendered.
         
         @param text: the title text
-        @keyword link: URL for the title
         @keyword msg: additional message (after saving)
         @keyword pagename: 'PageName'
         @keyword page: the page instance that called us.
@@ -1596,7 +1599,7 @@
 
         # If in print mode, start page div and emit the title
         if keywords.get('print_mode', 0):
-            d = {'title_text': text, 'title_link': None, 'page': page, }
+            d = {'title_text': text, 'page': page, }
             request.themedict = d
             output.append(self.startPage())
             output.append(self.interwiki(d))
@@ -1609,7 +1612,6 @@
                 'theme': self.name,
                 'script_name': scriptname,
                 'title_text': text,
-                'title_link': keywords.get('link', ''),
                 'logo_string': request.cfg.logo_string,
                 'site_name': request.cfg.sitename,
                 'page': page,
--- a/docs/CHANGES	Sun Aug 20 17:00:17 2006 +0200
+++ b/docs/CHANGES	Sun Aug 20 19:08:49 2006 +0200
@@ -138,6 +138,9 @@
       anyway), just use emit_http_headers and include a Status: XXX header.
       Method will vanish with moin 1.7. 
     * cfg.url_prefix is DEPRECATED, please use cfg.url_prefix_static.
+    * d['title_link'] is not supported any more. You can easily make that link
+      on your own in your theme, see example in MoinMoin/theme/__init__.py,
+      function "title".
 
   New Features:
     * Removed "underscore in URL" == "blank in pagename magic" - it made more