[The Trac Project] #3692: [PATCH] - Enable Generic use of INavigationContributor

21 views
Skip to first unread message

The Trac Project

unread,
Sep 9, 2006, 8:34:33 PM9/9/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: daniel
Type: enhancement | Status: new
Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: normal | Keywords:
---------------------------------+------------------------------------------
The following code
{{{
#!python
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.

--
Ticket URL: <http://trac.edgewall.org/ticket/3692>
The Trac Project <http://trac.edgewall.org/>

The Trac Project

unread,
Sep 10, 2006, 5:44:48 AM9/10/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: enhancement | Status: new
Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution:
Keywords: |
---------------------------------+------------------------------------------
Changes (by cboos):

* owner: daniel => cboos
* severity: normal => minor

Comment:

A few (minor) remarks:
- in attachment:ChromeNavigationLinks.diff, you used a "catch all"
exception handler, which is generally a bad idea. Better be specific, in
this case catching `AttributeError` is enough.
- if you can, please directly provide us with a full-contained example
component, in this case something like:
{{{
#!python
from trac.core import *
from trac.util.html import html
from trac.web.chrome import INavigationContributor

class ProjectNavigation(Component):
implements(INavigationContributor)

def get_active_navigation_item(self, req):
return 'guide'

def get_navigation_items(self, req):
yield 'projnav', 'guide', \

html.a('Project Guide', href=req.href.wiki('ProjectGuide'))
}}}
Note also that you should get used to write `req.href` instead of
`self.env.href`, as the latter form is now deprecated and will probably go
away in [milestone: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').

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:1>

The Trac Project

unread,
Sep 10, 2006, 11:42:05 AM9/10/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: enhancement | Status: new
Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution:
Keywords: |
---------------------------------+------------------------------------------
Comment (by 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?

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:2>

The Trac Project

unread,
Sep 10, 2006, 1:06:35 PM9/10/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: enhancement | Status: new
Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution:
Keywords: |
---------------------------------+------------------------------------------
Comment (by il...@lazaridis.com):

Replying to [comment:1 cboos]:

> - if you can, please directly provide us with a full-contained example
component,

the code is located
[http://dev.lazaridis.com/base/browser/infra/TracX/tracx/menus.py 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.

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:3>

The Trac Project

unread,
Sep 10, 2006, 1:29:49 PM9/10/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: enhancement | Status: new
Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution:
Keywords: |
---------------------------------+------------------------------------------
Comment (by il...@lazaridis.com):

Replying to [comment:2 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.

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:4>

The Trac Project

unread,
Sep 11, 2006, 3:12:47 AM9/11/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: enhancement | Status: closed

Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution: fixed
Keywords: |
---------------------------------+------------------------------------------
Changes (by cboos):

* status: new => closed
* resolution: => fixed

Comment:

Implemented slightly differently in r3717.

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:5>

The Trac Project

unread,
Sep 12, 2006, 1:42:24 AM9/12/06
to trac-t...@googlegroups.com
#3692: [PATCH] - Enable Generic use of INavigationContributor
---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: enhancement | Status: closed
Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution: fixed
Keywords: |
---------------------------------+------------------------------------------
Comment (by il...@lazaridis.com):

very nice, follow-up issue: #3704

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:6>

The Trac Project

unread,
Oct 7, 2006, 8:44:18 AM10/7/06
to trac-t...@googlegroups.com
#3692: smart+question

---------------------------------+------------------------------------------
Reporter: il...@lazaridis.com | Owner: cboos
Type: defect | Status: closed

Priority: normal | Milestone: 0.10
Component: project | Version: 0.10b1
Severity: minor | Resolution: fixed
Keywords: |
---------------------------------+------------------------------------------
Changes (by Nathaniell):

* type: enhancement => defect
* summary: [PATCH] - Enable Generic use of INavigationContributor =>
smart+question

Comment:

hello guys! http://hometown.aol.com/skylineblog/

--
Ticket URL: <http://trac.edgewall.org/ticket/3692#comment:7>

Reply all
Reply to author
Forward
0 new messages