Edgewall Software

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#4464 closed defect (wontfix)

PHP files doesn't shown correctly

Reported by: anonymous Owned by: Christian Boos
Priority: normal Milestone:
Component: version control/browser Version: devel
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


I using trac 0.11dev, with some php files in my svn brunch. Some of this php files are shown correctly but some doesn't shown. They looks like they are empty.

Here the logfile of trac.log:

2006-12-27 16:57:28,799 Trac[api] WARNING: HTML preview using <tracpygments.PygmentsRenderer object at 0xb6e54a6c> failed ('module' object has no attribute 'get_lexer_by_name')
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 459, in render
    rendered_content, filename, url)
  File "build/bdist.linux-i686/egg/tracpygments/__init__.py", line 77, in render
  File "build/bdist.linux-i686/egg/tracpygments/__init__.py", line 112, in _format
AttributeError: 'module' object has no attribute 'get_lexer_by_name'

Attachments (0)

Change History (10)

comment:1 by Tim Hatch, 16 years ago

Component: generalbrowser
Keywords: needinfo added
Owner: changed from Jonas Borgström to Christian Boos


Trunk now supports Pygments without using the plugin. Try disabling the plugin and see if it works. Make sure you're using trunk from at least r4466 along with Pygments 0.6+.

comment:2 by anonymous, 16 years ago

Thanks, the warning, error is gone. But the php source doesn't shown after the change.

comment:3 by Tim Hatch, 16 years ago

Okay, first verify your Genshi is recent (0.3.6 IIRC). If it's still an issue, please paste the relevant portion of the log.

comment:4 by anonymous, 16 years ago

I have the newest genshi version installed on my system (version 0.3.6). I set the LOG output to DEBUG, but nothing is written to the logfile if i browse to "browser/trunk/lib/Calc.php?order=name".

in reply to:  4 comment:5 by anonymous, 16 years ago

Replying to anonymous:

I have the newest genshi version installed on my system (version 0.3.6). I set the LOG output to DEBUG, but nothing is written to the logfile if i browse to "browser/trunk/lib/Calc.php?order=name".

Sry, i have forgotten to restart tracd, here the logfile output:

2006-12-28 14:24:52,712 Trac[main] DEBUG: Dispatching <Request "GET /browser/trunk/lib/Calc.php">
2006-12-28 14:24:52,724 Trac[chrome] DEBUG: Prepare chrome data for request
2006-12-28 14:24:52,734 Trac[browser] DEBUG: Rendering preview of node Calc.php@None with mime-type text/x-php; charset=iso-8859-15
2006-12-28 14:24:52,735 Trac[api] DEBUG: Trying to render HTML preview using PygmentsRenderer

comment:6 by anonymous, 16 years ago

Can this a bug of the php interpreter (/usr/bin/php), that handle the php highlighting?

comment:7 by Tim Hatch, 16 years ago

If that's all the log shows, it would not be caused by the php highlighter, because it's using Pygments which is completely separate.

Rereading the initial report, does it only do this on certain files, or do all php files show up as blank? Is there something special about those (non-ascii characters, CR-only line separators) and do other files using Pygments render correctly (css, for example)?

comment:8 by anonymous, 16 years ago

This is some different php files but not all php files, thats a little bit strange. —- After a little test i found out the difference between this php files, some have the close tag:


and some haven't. That files that haven't this tag doesn't shown by trac.

comment:9 by Tim Hatch, 16 years ago

Keywords: needinfo removed
Resolution: wontfix
Status: newclosed

Confirmed. That's indeed a Pygments bug, now reported as http://trac.pocoo.org/ticket/180

You can work around this in the meantime by setting

pygments_modes =  text/x-php:php:9

in your trac.ini, which disables the combo html+php renderer in favor of just php.

Closing as wontfix, since it's a Pygments bug.

comment:10 by Georg Brandl, 16 years ago

Just wanted to note that this is now fixed in Pygments trunk.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.