Edgewall Software

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#11169 closed enhancement (fixed)

`render_resource_link` should add the "missing" class if the resource doesn't exist — at Version 4

Reported by: Ryan J Ollos <ryan.j.ollos@…> Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.2
Component: rendering Version: 1.0-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

When get_resource_description doesn't return an Element (e.g. when the IResourceManager doesn't implement get_resource_description), render_resource_link adds the missing class and the rel=nofollow attribute if the resource has a ResourceManager and the resource doesn't exist. The realm is always added as a class.

Internal Changes:

Description

In the case that get_resource_description doesn't return an Element, render_resource_link should check whether the resource exists and add the missing class if it doesn't.

This is mainly useful for plugins at the moment, since render_resource_link is only utilized once in the Trac source. In this one case that it is used, a context parameter is passed, so an Element will be returned by render_resource_link and the pathway that this ticket proposes to modify is not being executed in that case.

I've prepared a patch in ff9c10ec. I don't like how the test case adds a dependency on trac.wiki.model.WikiPage, but I didn't have any better ideas at the moment and struggled to figure out the right way to code a "dummy" ResourceManager. I'll iterate on the patch if anyone can provide suggestions on how to improve.

Change History (4)

comment:1 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

  • 53e03e02 Added rel='nofollow' attribute to the 'missing link'.

comment:2 by Ryan J Ollos, 10 years ago

Milestone: 1.1.2
Owner: set to Ryan J Ollos
Status: newassigned

comment:3 by Ryan J Ollos, 10 years ago

The test cases have been improved. Revised changes proposed in rjollos.git:t11169.2:

  • adds the realm as a class for the link.
  • adds the missing class and the rel=nofollow attribute to the link if the resource has a ResourceManager and the resource does not exist.

comment:4 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [12308].

Note: See TracTickets for help on using tickets.