Edgewall Software

Changes between Version 1 and Version 2 of TracDev/PluginDevelopment/ExtensionPoints/trac.mimeview.api.IHTMLPreviewAnnotator


Ignore:
Timestamp:
Jul 23, 2011 10:29:23 PM (3 years ago)
Author:
rblank
Comment:

Not a bad idea, the coding style annotator! Fixed the example to make it thread safe.

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/PluginDevelopment/ExtensionPoints/trac.mimeview.api.IHTMLPreviewAnnotator

    v1 v2  
    4444
    4545    def get_annotation_data(self, context):
    46         self.violations = 0
    47         return None
     46        return {'violations': 0}
    4847
    4948    def annotate_row(self, context, row, lineno, line, data):
    5049        if len(to_unicode(line)) > 79:
     50            data['violations'] += 1
    5151            row.append(tag.th(tag.a(_('!'),
    52                                     href='#Violation%d' % self.violations),
     52                                    href='#Violation%d' % data['violations']),
    5353                              title=_('Line is too long'),
    54                               id_='Violation%d' % self.violations))
     54                              id_='Violation%d' % data['violations']))
    5555        else:
    5656            row.append(tag.th())