Modify

Opened 6 years ago

Closed 2 years ago

Last modified 2 years ago

#11073 closed enhancement (fixed)

Get more appropriate resource ID from rendering context

Reported by: Steffen Hoffmann Owned by: Jun Omae
Priority: normal Component: VotePlugin
Severity: normal Keywords:
Cc: Steffen Hoffmann Trac Release:

Description

VoteList has an issue when included into a milestone description, but executed in /roadmap context, where it will show all recent votes instead of just these for the corresponding milestone.

While the root cause obviously is the inability to retrieve a valid resource ID (roadmap itself is not vote-able yet for the same reason), a backwards-compatible fix is not trivial, but certainly required.

Attachments (2)

t11073.diff (4.6 KB) - added by Jun Omae 2 years ago.
t11073.1.diff (5.7 KB) - added by Ryan J Ollos 2 years ago.

Download all attachments as: .zip

Change History (22)

comment:1 Changed 6 years ago by Steffen Hoffmann

From previous work for BreadCrumbsNavPlugin I remember, that there are at least two, if not three different ways to get a resource ID from rendering context.

I'll have to dig that out again, and will very likely lift valuable code and inspiration for that plugin from here as well. Like with BookmarkPlugin there are some amazing similarities.

comment:2 Changed 4 years ago by Ryan J Ollos

Owner: Ryan J Ollos deleted

Feel free to push ahead now that 0.2.0 and 0.3.0 have been released.

comment:3 Changed 4 years ago by Ryan J Ollos

A related issue revealed in #12595 is that the parent resource is not extracted from the path, needed for realms such as changeset.

comment:4 Changed 4 years ago by Ryan J Ollos

I think it was mentioned elsewhere, it would be nice to backport resource_from_path to Trac.

comment:5 in reply to:  4 Changed 2 years ago by Ryan J Ollos

Replying to Ryan J Ollos:

I think it was mentioned elsewhere, it would be nice to backport resource_from_path to Trac.

=> trac:#12813.

comment:6 Changed 2 years ago by Ryan J Ollos

Type: defectenhancement

Changed 2 years ago by Jun Omae

Attachment: t11073.diff added

comment:7 Changed 2 years ago by Jun Omae

I think we should use data['context'].resource in post_process_request() rather than resource_from_path which is detecting resource from path.

See attachment:t11073.diff.

Another issue, attachment and changeset resources are not supported since missing parent realm and id in votes table.

Last edited 2 years ago by Jun Omae (previous) (diff)

comment:8 Changed 2 years ago by Ryan J Ollos

In 16916:

TracVote 0.7.0dev: Make tests pass with Trac 1.0-stable and trunk

Refs #11073.

comment:9 Changed 2 years ago by Ryan J Ollos

In 16917:

TracVote 0.7.0dev: Remove unused import and bump version

Refs #11073.

comment:10 Changed 2 years ago by Ryan J Ollos

t11073.diff looks good to me. Please commit.

comment:11 Changed 2 years ago by Jun Omae

In 16918:

TracVote 0.7.0dev: use assertEqual(None, ...) instead of assertIsNone to make compatible with Python 2.5

Refs #11073.

comment:12 Changed 2 years ago by Jun Omae

In 16919:

TracVote 0.7.0dev: fix comparing version strings in unit tests

Refs #11073.

comment:13 Changed 2 years ago by Jun Omae

Owner: set to Jun Omae
Resolution: fixed
Status: newclosed

In 16920:

TracVote 0.7.0dev: retrieve resource object from rendering context

Fix #11073.

comment:14 Changed 2 years ago by Jun Omae

Thanks for the review! Committed several changes and the patch.

comment:15 Changed 2 years ago by Ryan J Ollos

In 16921:

TracVote 0.7.0dev: Make compatible with Trac 1.3.2+ (Jinja2)

Refs #11073.

Changed 2 years ago by Ryan J Ollos

Attachment: t11073.1.diff added

comment:16 Changed 2 years ago by Ryan J Ollos

Additional inspired changes: t11073.1.diff.

comment:17 Changed 2 years ago by Ryan J Ollos

In 16922:

TracVote 0.7.0dev: Avoid using $ at global scope

Refs #11073.

comment:18 in reply to:  7 Changed 2 years ago by Ryan J Ollos

Replying to Ryan J Ollos:

A related issue revealed in #12595 is that the parent resource is not extracted from the path, needed for realms such as changeset.

Replying to Jun Omae:

Another issue, attachment and changeset resources are not supported since missing parent realm and id in votes table.

=> #13315.

comment:19 in reply to:  16 Changed 2 years ago by Jun Omae

Replying to Ryan J Ollos:

Additional inspired changes: t11073.1.diff.

Looks good to me.

comment:20 Changed 2 years ago by Ryan J Ollos

In 16933:

TracVote 0.7.0dev: Refactor to use resource from context

Follow-on to r16920. Thanks to Jun Omae for review.

Refs #11073.

Modify Ticket

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