Edgewall Software
Modify

Opened 17 years ago

Closed 9 years ago

Last modified 9 years ago

#6003 closed enhancement (wontfix)

[PATCH] Add priorities to components

Reported by: Paolo Capriotti Owned by:
Priority: normal Milestone:
Component: general Version: devel
Severity: normal Keywords: core
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

This patch adds support for priorities in components. Whenever a component declares to implement an extension point interface, it can specify a priority. Components are then ordered (hence retrieved) by priorities. The syntax is:

class MyComponent(Component):
  implements(IRequestHandler, priority = -5)

The priority must be an integer (or convertible to integer), and applies to all interfaces in the implements function call. If not specified is considered to be 0. A lower number means higher priority. In the example, MyComponent has a higher priority than any built-in request handler, hence its match_request method ends up being called first.

Attachments (1)

priorities.diff (2.1 KB ) - added by Paolo Capriotti 17 years ago.

Download all attachments as: .zip

Change History (7)

by Paolo Capriotti, 17 years ago

Attachment: priorities.diff added

comment:1 by Noah Kantrowitz, 17 years ago

There are already workarounds for this, though they should be considered hacks at best. -1.

comment:2 by Christopher Lenz, 17 years ago

Though I do think there's a problem here that may need to be properly addressed at some point, hardcoding a numeric priority in components is not a proper solution, in my humble opinion. We'd need something more dynamic that can be influenced by the user/admin, because that's where the conflicts are going to come up.

comment:3 by Christian Boos, 17 years ago

Keywords: core added
Milestone: 1.0

Paolo, when an ordering is actually required among specific components, we already have a mechanism for this: trac.config.OrderedExtensionOption. This might be what you were looking for. If instead you wanted a way to override any component, then we should wait for the more generic solution suggested in the above comment:2 (which I think this ticket should be dedicated to, hence the 1.0).

comment:4 by Christian Boos, 14 years ago

Milestone: 1.0unscheduled

Milestone 1.0 deleted

comment:5 by Ryan J Ollos, 9 years ago

Owner: Jonas Borgström removed

comment:6 by Ryan J Ollos, 9 years ago

Milestone: unscheduled
Resolution: wontfix
Status: newclosed

The proposed patch has been voted down and the alternate proposed solution is vague, so closing this ticket.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.