diff MoinMoin/theme/__init__.py @ 3048:1e9444f35a22

Fix "MakeIconLinkLosesAltTitle", thanks to "bolekk". (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 19 Feb 2008 23:18:27 +0100
parents 8608b258f8e6
children d2e9afd64276
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Tue Feb 19 23:15:17 2008 +0100
+++ b/MoinMoin/theme/__init__.py	Tue Feb 19 23:18:27 2008 +0100
@@ -525,9 +525,12 @@
             vars = {}
         alt, img, w, h = self.get_icon(icon)
         try:
-            alt = alt % vars
+            alt = vars['icon-alt-text'] # if it is possible we take the alt-text from 'page_icons_table'
         except KeyError, err:
-            alt = 'KeyError: %s' % str(err)
+            try:
+                alt = alt % vars # if not we just leave the  alt-text from 'icons'
+            except KeyError, err:
+                alt = 'KeyError: %s' % str(err)
         alt = self.request.getText(alt, formatted=False)
         tag = self.request.formatter.image(src=img, alt=alt, width=w, height=h, **kw)
         return tag
@@ -544,7 +547,7 @@
         qs = {}
         querystr, title, icon = self.cfg.page_icons_table[which]
         qs.update(querystr) # do not modify the querystr dict in the cfg!
-        d['title'] = title % d
+        d['icon-alt-text'] = d['title'] = title % d
         d['i18ntitle'] = self.request.getText(d['title'], formatted=False)
         img_src = self.make_icon(icon, d)
         rev = d['rev']