Edgewall Software

Opened 9 years ago

Last modified 8 years ago

#12183 closed defect

Possible mistyped processor on TracDownload — at Version 4

Reported by: figaro Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.9
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Prevent WikiProcessor error in TracGuide when Pygments is not installed.

API Changes:
Internal Changes:

Description (last modified by figaro)

At the bottom of page TracDownload the following is shown: Error: Failed to load processor apache No macro or processor named 'apache' found

This is possibly the result of a mistyped processor on that page.

Change History (4)

comment:1 by figaro, 9 years ago

Description: modified (diff)
Summary: Possible mistyped processor on TracDownload#LatestStableReleasePossible mistyped processor on TracDownload

Updated description and summary.

comment:2 by Ryan J Ollos, 9 years ago

This is due to a Pygments installation issue that I've noted in our internal issue tracker. However, the issue is also present on TracModWSGI which gets distributed with Trac so the errors will be seen whenever Pygments is not installed. We should probably add a known mimetype for the ApacheConf Lexer:

  • trac/mimeview/api.py

    diff --git a/trac/mimeview/api.py b/trac/mimeview/api.py
    index aae3172..96f2c72 100644
    a b KNOWN_MIME_TYPES = {  
    304304    'text/xml':                'xml',
    305305
    306306    # see also TEXT_X_TYPES below
     307    'text/x-apacheconf':       'apache',
    307308    'text/x-csrc':             'c xs',
    308309    'text/x-chdr':             'h',
    309310    'text/x-c++src':           'cc CC cpp C c++ C++',

comment:3 by Jun Omae, 9 years ago

That change looks good to me. We could add check of invalid wiki processors to checkwiki.py.

  • contrib/checkwiki.py

    diff --git a/contrib/checkwiki.py b/contrib/checkwiki.py
    index c9b8029ff..fbc874dbd 100755
    a b class DefaultWikiChecker(Formatter):  
    5151                self.__marks.append((fullmatch.start(0), fullmatch.end(0)))
    5252        return rv
    5353
     54    def handle_code_block(self, line, startmatch=None):
     55        prev_processor = getattr(self, 'code_processor', None)
     56        try:
     57            return self.__super.handle_code_block(line, startmatch)
     58        finally:
     59            processor = self.code_processor
     60            if startmatch and processor and processor != prev_processor and \
     61                    processor.error:
     62                self.__marks.append((startmatch.start(0), startmatch.end(0)))
     63
    5464    def format(self, text, out=None):
    5565        return self.__super.format(SourceWrapper(self, text), out)
    5666
    def main():  
    160170    if options.download:
    161171        download_default_pages(args, options.prefix)
    162172
    163     env = EnvironmentStub()
     173    env = EnvironmentStub(disable=['trac.mimeview.pygments.*'])
    164174    load_components(env)
    165175    with env.db_transaction:
    166176        for name in names:

The same issue raises on #!pycon in TracPlugins page.

$ python contrib/checkwiki.py | grep '#!' | sed -e 's/^\([^:]*\):[0-9]*:\(.*\)$/\1:\2/' | sort | uniq -c
      3 TracCgi:{{{#!apache
      1 TracFineGrainedPermissions:{{{#!apache
      3 TracInstall:{{{#!apache
      3 TracInterfaceCustomization:{{{#!apache
     18 TracModPython:{{{#!apache
     15 TracModWSGI:{{{#!apache
      4 TracPlugins:{{{#!apache
      1 TracPlugins:{{{#!pycon
      1 TracStandalone:{{{#!apache

comment:4 by Ryan J Ollos, 9 years ago

Milestone: 1.0.9
Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned
Type: taskdefect

comment:2 change committed to 1.0-stable in [14277], merged to trunk in [14278].

The change in comment:3 seems like a good idea.

Note: See TracTickets for help on using tickets.