#12183 closed defect (fixed)
Possible mistyped processor on TracDownload
Reported by: | figaro | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.9 |
Component: | general | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Added |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
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.
Attachments (0)
Change History (13)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|---|
Summary: | Possible mistyped processor on TracDownload#LatestStableRelease → Possible mistyped processor on TracDownload |
comment:2 by , 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 = { 304 304 'text/xml': 'xml', 305 305 306 306 # see also TEXT_X_TYPES below 307 'text/x-apacheconf': 'apache', 307 308 'text/x-csrc': 'c xs', 308 309 'text/x-chdr': 'h', 309 310 'text/x-c++src': 'cc CC cpp C c++ C++',
follow-up: 6 comment:3 by , 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): 51 51 self.__marks.append((fullmatch.start(0), fullmatch.end(0))) 52 52 return rv 53 53 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 54 64 def format(self, text, out=None): 55 65 return self.__super.format(SourceWrapper(self, text), out) 56 66 … … def main(): 160 170 if options.download: 161 171 download_default_pages(args, options.prefix) 162 172 163 env = EnvironmentStub( )173 env = EnvironmentStub(disable=['trac.mimeview.pygments.*']) 164 174 load_components(env) 165 175 with env.db_transaction: 166 176 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 , 9 years ago
Milestone: | → 1.0.9 |
---|---|
Owner: | set to |
Release Notes: | modified (diff) |
Status: | new → assigned |
Type: | task → defect |
comment:5 by , 9 years ago
follow-up: 8 comment:6 by , 9 years ago
Replying to jomae:
The same issue raises on
#!pycon
in TracPlugins page.
I can reproduce locally, but strangely the error is not raised on the TracPlugins page of t.e.o even though Pygments is not currently installed.
Should we add pycon to known mimetypes?:
-
trac/mimeview/api.py
diff --git a/trac/mimeview/api.py b/trac/mimeview/api.py index 196e55b..d803f0d 100644
a b KNOWN_MIME_TYPES = { 338 338 'text/x-perl': 'pl pm PL', 339 339 'text/x-php': 'php3 php4', 340 340 'text/x-python': 'py', 341 'text/x-python-doctest': 'pycon', 341 342 'text/x-pyrex': 'pyx', 342 343 'text/x-ruby': 'rb', 343 344 'text/x-scheme': 'scm',
comment:7 by , 9 years ago
Looks like we also need to handle the genshi keyword, at least on the trunk:
-
trac/mimeview/api.py
diff --git a/trac/mimeview/api.py b/trac/mimeview/api.py index baaaa0d..281a313 100644
a b KNOWN_MIME_TYPES = { 301 301 'application/x-dos-batch': 'bat batch cmd dos', 302 302 'application/x-sh': 'sh', 303 303 'application/x-csh': 'csh', 304 'application/x-genshi': 'genshi', 304 305 'application/x-troff': 'nroff roff troff', 305 306 'application/x-yaml': 'yml yaml',
comment:8 by , 9 years ago
Replying to rjollos:
Replying to jomae:
The same issue raises on
#!pycon
in TracPlugins page.I can reproduce locally, but strangely the error is not raised on the TracPlugins page of t.e.o even though Pygments is not currently installed.
Is that because it's in t.e.o's TracIni#mimeviewer-section:
[mimeviewer] mime_map = application/x-genshi:genshi, application/x-genshi-text:genshitext, text/x-python-doctest:pycon, text/x-ini:ini, text/coffeescript:coffee
comment:9 by , 9 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
follow-up: 11 comment:10 by , 9 years ago
I added nginx
and apache
to [mimeviewer] mime_map
to prevent WikiProcessor errors when pygments is not installed.
Please let me know if you spot any other WikiProcessors on the site that are showing errors.
follow-up: 13 comment:11 by , 9 years ago
Replying to Ryan J Ollos:
I added
nginx
andapache
to[mimeviewer] mime_map
to prevent WikiProcessor errors when pygments is not installed.
Removed apache
, genshi
and pycon
keywords from [mimeviewer]
mime_map
since t.e.o has been upgraded to 1.2dev and those keywords are contained in KNOWN_MIME_TYPES
.
comment:12 by , 9 years ago
Release Notes: | modified (diff) |
---|
Added nginx
in [14285] to [mimeviewer]
mime_map
to prevent WikiProcessor errors when pygments is not installed. Merged in [14286].
comment:13 by , 9 years ago
Replying to rjollos:
Replying to Ryan J Ollos:
I added
nginx
andapache
to[mimeviewer] mime_map
to prevent WikiProcessor errors when pygments is not installed.Removed
apache
,genshi
andpycon
keywords from[mimeviewer]
mime_map
since t.e.o has been upgraded to 1.2dev and those keywords are contained inKNOWN_MIME_TYPES
.
Removed nginx
from mime_map
since we are now running later than r14286.
Updated description and summary.