#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)
Change History (7)
by , 17 years ago
Attachment: | priorities.diff added |
---|
comment:1 by , 17 years ago
comment:2 by , 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 , 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:5 by , 9 years ago
Owner: | removed |
---|
comment:6 by , 9 years ago
Milestone: | unscheduled |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
The proposed patch has been voted down and the alternate proposed solution is vague, so closing this ticket.
There are already workarounds for this, though they should be considered hacks at best. -1.