Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12554 closed defect (fixed)

[PATCH] Broken link when viewing milestone page if version name contains spaces

Reported by: Cinc-th Owned by: Cinc-th
Priority: low Component: ExtendedVersionPlugin
Severity: minor Keywords:
Cc: Trac Release: 0.12

Description

When viewing a milestone page the version information is added to the due/completed date line as can be seen here:

The link points to the page for that particular version.

With version names containing spaces the link is broken because only the first word of the version name is used to specify the link target. The following patch resolves the issue:

  • trunk/extendedversion/milestone.py

     
    119119            context = Context.from_request(req,
    120120                                           Resource('milestone', milestone))
    121121            return tag.span(
    122                 "; ",
    123122                format_to_oneliner(self.env, context,
    124                                    "For version:%s" % (row[0],)),
     123                                   "; For [version:'%s' %s]" % (row[0], row[0])),
    125124                class_="date")
    126125        else:
    127126            return []

Attachments (1)

version_link_12554.patch (781 bytes) - added by Cinc-th 9 years ago.
Patch to allow links to versions with spaces in name.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Cinc-th

Attachment: version_link_12554.patch added

Patch to allow links to versions with spaces in name.

comment:1 Changed 9 years ago by Jun Omae

I think we should directly create a link for the version rather than uses of format_to_oneline. The format_to_* methods are slow.

Untested patch:

  • extendedversionplugin/trunk/extendedversion/milestone.py

    diff --git a/extendedversionplugin/trunk/extendedversion/milestone.py b/extendedversionplugin/trunk/extendedversion/milestone.py
    index 74816a4..2d0a85e 100644
    a b from trac.resource import Resource 
    1616from trac.util.datefmt import to_timestamp
    1717from trac.web.api import IRequestFilter, ITemplateStreamFilter
    1818from trac.web.chrome import INavigationContributor
    19 from trac.wiki.formatter import format_to_oneliner
     19
     20from extendedversion.version import VisibleVersion
    2021
    2122
    2223class MilestoneVersion(Component):
    class MilestoneVersion(Component): 
    118119        if row:
    119120            context = Context.from_request(req,
    120121                                           Resource('milestone', milestone))
    121             return tag.span(
    122                 "; ",
    123                 format_to_oneliner(self.env, context,
    124                                    "For version:%s" % (row[0],)),
    125                 class_="date")
     122            link = VisibleVersion(self.env)._render_link(context, row[0],
     123                                                         row[0])
     124            return tag.span("; For ", link, class_="date")
    126125        else:
    127126            return []
    128127

comment:2 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 14998:

1.0dev: Properly render version link with whitespace.

Patch by Cinc-th and jun66j5. Fixes #12554.

comment:3 Changed 9 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to Cinc-th

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Cinc-th.
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.