Modify

Opened 4 years ago

Closed 4 years ago

#8327 closed defect (fixed)

Changeset 9586 generates unwanted links on Trac 0.12

Reported by: AllenB Owned by: rjollos
Priority: high Component: AcronymsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

The recent changes made in r9586 are causing Trac 0.12 to turn all acronyms into links.

For example, I have the following defined in my AcronymDefinitions:

||'''Acronym'''||'''Description'''||
||ROM||Read-Only Memory||

When I use the text Acronym test ROM. on a wiki page, the following HTML is generated:

Acronym test <a class="acronym" href="/MyProject/wiki/"><acronym title="Read-Only Memory">ROM</acronym></a>.

If I comment out lines 62-63 of acronyms.py (the lines added in r9586), then the resulting HTML code is as expected:

Acronym test <acronym title="Read-Only Memory">ROM</acronym>.

I suspect that this is due to the templating differences between 0.11 and 0.12, as 'href' is of type 'genshi._speedups.Markup' at line 61 (which causes the conditional on line 62 to always evaluate true).

I know Trac 0.12 isn't listed as being 'officially' supported by this plugin, but this bug seems to be the only thing keeping it from working so I figured I'd report it.

Attachments (0)

Change History (4)

comment:1 Changed 4 years ago by AllenB

Based on my initial experimentation, changing the following lines:

if not urlparse(href).scheme:
    href = self.env.href.wiki(href)

to:

if (not urlparse(href).scheme) and (len(href.__str__()) > 0):
    href = self.env.href.wiki(href)

seems to have fixed the problem. I haven't done extensive testing, but acronyms both with and without links seem to generate correct code (even for wiki sub-pages).

comment:2 Changed 4 years ago by rjollos

  • Priority changed from normal to high
  • Status changed from new to assigned

Thanks for the report. Your solution appears to be correct. I will try to get it patched by this weekend.

comment:3 Changed 4 years ago by rjollos

Definite error here on my part, and the issue almost certainly existed in Trac 0.11 as well. Posting a fix shortly.

comment:4 Changed 4 years ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9741]) In [9586], a defect was introduced whereby acronyms without a URL definition would generate links to WikiStart. Thanks to AllenB for catching this. Fixes #8327.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from rjollos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.