#3692 closed enhancement (fixed)
[PATCH] - Enable Generic use of INavigationContributor
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | project | Version: | 0.10b1 |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The following code
implements(INavigationContributor) def get_navigation_items(self, req): yield 'projnav', 'guide', html.a( 'Project Guide', href=self.env.href.wiki('ProjectGuide') )
crashes within source:/trunk/trac/web/chrome.py, as there's no Option "projnav_order" defined.
The attached patch enables that code without the need to define an Option.
This way, new custom navigation items can be generated dynamically, without any modifications in the source code / ini-files.
Attachments (2)
Change History (8)
by , 18 years ago
Attachment: | ChromeNavigationLinks.diff added |
---|
follow-up: 3 comment:1 by , 18 years ago
Owner: | changed from | to
---|---|
Severity: | normal → minor |
follow-up: 4 comment:2 by , 18 years ago
Well, if we're going to support custom navigation items then they should probably support ordering as well. However, I don't want to keep pushing back 0.10 for new features. Can we at least push this to 0.10.1 to get some more information?
comment:3 by , 18 years ago
Replying to cboos:
- if you can, please directly provide us with a full-contained example component,
the code is located here (corrected to use "self.env.href"):
As for the (fixed) patch itself, I'm +1 if you can show us how you intend to make use of the non-standard navigation category (i.e. something else than 'metanav' and 'mainnav').
You can find an example usage here (menu below project title):
http://dev.lazaridis.com/base
I'll attach a corrected patch.
by , 18 years ago
Attachment: | ChromeNavigationLinksAttributeError.diff added |
---|
corrected to catch only AttributeError
comment:4 by , 18 years ago
Replying to mgood:
Well, if we're going to support custom navigation items then they should probably support ordering as well. However, I don't want to keep pushing back 0.10 for new features. Can we at least push this to 0.10.1 to get some more information?
- Custom navigation items are already supported. This patch removes just a tiny defect (possibly I should have filed a "defect" instead of "enhancement"), thus "custom navigation items" can be created again. This patch can/should be applied now, as it corrects the defect behaviour of the ordering-mechanism.
- See #3695: The ordering mechanism could be refactored in order to avoid the necessity to hardcode the option within chrome.py. This should be implemented later, as it changes behaviour and would possibly block the 0.10 release.
comment:5 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Implemented slightly differently in r3717.
A few (minor) remarks:
AttributeError
is enough.Note also that you should get used to write
req.href
instead ofself.env.href
, as the latter form is now deprecated and will probably go away in 0.11.As for the (fixed) patch itself, I'm +1 if you can show us how you intend to make use of the non-standard navigation category (i.e. something else than 'metanav' and 'mainnav').