changeset 1382:c3c8ff25e979

make more use of formatter / link_to for link rendering
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 21 Aug 2006 01:30:06 +0200
parents 62c013c1d87a
children fdb726f0f34f
files MoinMoin/macro/MonthCalendar.py MoinMoin/theme/__init__.py
diffstat 2 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/MonthCalendar.py	Sun Aug 20 23:50:40 2006 +0200
+++ b/MoinMoin/macro/MonthCalendar.py	Mon Aug 21 01:30:06 2006 +0200
@@ -334,16 +334,16 @@
         while st < l:
             ch = parmpagename[0][st:st+chstep]
             r, g, b = cliprgb(r, g, b)
-            pagelinks = pagelinks + '<a style="%s" href="%s">%s</a>' % \
-                ('background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % \
-                    (r, g, b), Page(request, parmpagename[0]).url(request), ch)
+            link = Page(request, parmpagename[0]).link_to(request, ch,
+                        style='background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % (r, g, b))
+            pagelinks = pagelinks + link
             r, g, b = (r, g+colorstep, b)
             st = st + chstep
         r, g, b = (255-colorstep, 255, 255-colorstep)
         for page in parmpagename[1:]:
-            pagelinks = pagelinks + '*<a style="%s" href="%s">%s</a>' % \
-                            ('background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % \
-                                (r, g, b), Page(request, page).url(request), page)
+            link = Page(request, page).link_to(request, page,
+                        style='background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % (r, g, b))
+            pagelinks = pagelinks + '*' + link
         showpagename = '   %s<BR>\n' % pagelinks
     else:
         showpagename = ''
--- a/MoinMoin/theme/__init__.py	Sun Aug 20 23:50:40 2006 +0200
+++ b/MoinMoin/theme/__init__.py	Mon Aug 21 01:30:06 2006 +0200
@@ -326,7 +326,9 @@
         for scheme in self.linkSchemas:
             if pagename.startswith(scheme):
                 title = wikiutil.escape(title)
-                link = '<a href="%s">%s</a>' % (pagename, title)
+                link = self.request.formatter.url(1, pagename) + \
+                       self.request.formatter.text(title) +\
+                       self.request.formatter.url(0)
                 return pagename, link
 
         # remove wiki: url prefix
@@ -845,8 +847,10 @@
         @rtype: unicode
         @return: rss href
         """
-        return (u'%s/RecentChanges?action=rss_rc&amp;ddiffs=1&amp;unique=1'
-                % self.request.getScriptname())
+        request = self.request
+        url = Page(request, 'RecentChanges').url(request, querystr={
+                'action':'rss_rc', 'ddiffs': '1', 'unique': '1', }, escape=0, relative=False)
+        return url
 
     def rsslink(self):
         """ Create rss link in head, used by FireFox
@@ -1345,9 +1349,9 @@
         if self.shouldUseRSS():
             link = [
                 u'<div class="rcrss">',
-                u'<a href="%s">' % self.rsshref(),
-                self.make_icon("rss"),
-                u'</a>',
+                self.request.formatter.url(1, self.rsshref()),
+                self.request.formatter.rawHTML(self.make_icon("rss")),
+                self.request.formatter.url(0),
                 u'</div>',
                 ]
             html += ''.join(link)