Attachment '_init_.diff'

Download

   1 --- __init__old.py	2006-12-09 13:32:00.000000000 +0100
   2 +++ __init__new.py	2007-01-16 00:04:20.000000000 +0100
   3 @@ -478,7 +478,7 @@
   4  
   5      def make_icon(self, icon, vars=None):
   6          """
   7 -        This is the central routine for making <img> tags for icons!
   8 +        Central routine for making <img> tags for icons
   9          All icons stuff except the top left logo and search field icons are
  10          handled here.
  11          
  12 @@ -490,12 +490,18 @@
  13          if vars is None:
  14              vars = {}
  15          alt, img, w, h = self.get_icon(icon)
  16 -        try:
  17 -            alt = alt % vars
  18 -        except KeyError, err:
  19 -            alt = 'KeyError: %s' % str(err)
  20 +        if vars:
  21 +            try:
  22 +                alt = vars['alt']
  23 +            except KeyError, err:
  24 +                try:
  25 +                    alt = alt % vars
  26 +                except KeyError, err:
  27 +                    alt = 'KeyError: %s' % str(err)
  28 +
  29          if self.request:
  30              alt = self.request.getText(alt, formatted=False)
  31 +
  32          try:
  33              tag = self.request.formatter.image(src=img, alt=alt, width=w, height=h)
  34          except AttributeError: # XXX FIXME if we have no formatter or no request 
  35 @@ -515,16 +521,16 @@
  36          @return: html link tag
  37          """
  38          querystr, title, icon = self.cfg.page_icons_table[which]
  39 -        d['title'] = title % d
  40 +        d['alt'] = d['title'] = title
  41          d['i18ntitle'] = self.request.getText(d['title'], formatted=False)
  42          img_src = self.make_icon(icon, d)
  43          rev = d['rev']
  44          if rev and which in ['raw', 'print', ]:
  45              querystr['rev'] = str(rev)
  46 -        attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], }
  47 +        attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], 'alt': d['i18ntitle'],}
  48          page = d['page']
  49          return page.link_to_raw(self.request, text=img_src, querystr=querystr, **attrs)
  50 -
  51 +    
  52      def msg(self, d):
  53          """ Assemble the msg display
  54  

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-01-15 23:05:55, 2.0 KB) [[attachment:_init_.diff]]
  • [get | view] (2007-01-06 15:41:23, 5.2 KB) [[attachment:screenshot.jpg]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.