Modify

Opened 13 years ago

Closed 13 years ago

#8327 closed defect (fixed)

Changeset 9586 generates unwanted links on Trac 0.12

Reported by: Ben Allen Owned by: Ryan J Ollos
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 13 years ago by Ben Allen

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 13 years ago by Ryan J Ollos

Priority: normalhigh
Status: newassigned

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

comment:3 Changed 13 years ago by Ryan J Ollos

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 13 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.