[Trac-tickets] [The Trac Project] #1571: Cannot add custom plugins
that implement INavigationContributor
The Trac Project
noreply at edgewall.com
Tue May 17 17:24:46 EDT 2005
#1571: Cannot add custom plugins that implement INavigationContributor
---------------------+------------------------------------------------------
Id: 1571 | Status: new
Component: general | Modified: Tue May 17 17:24:46 2005
Severity: normal | Milestone: 0.9
Priority: normal | Version: devel
Owner: cmlenz | Reporter: ebcom
---------------------+------------------------------------------------------
In {{{chrome.py}}}, line 146
{{{
#!python
items.sort(lambda x,y: cmp(order.index(x[0]), order.index(y[0])))
}}}
fails to execute with the following dump:
{{{
Traceback (most recent call last):
File "D:\tmp\trac\current\Lib\site-packages\trac\web\standalone.py",
line 213, in _do_trac_req
dispatch_request(path_info, req, env)
File "D:\tmp\trac\current\Lib\site-packages\trac\web\main.py", line 419,
in dispatch_request
dispatcher.dispatch(req)
File "D:\tmp\trac\current\Lib\site-packages\trac\web\main.py", line 276,
in dispatch
chrome.populate_hdf(req, chosen_handler)
File "D:\tmp\trac\current\Lib\site-packages\trac\web\chrome.py", line
146, in populate_hdf
items.sort(lambda x,y: cmp(order.index(x[0]), order.index(y[0])))
File "D:\tmp\trac\current\Lib\site-packages\trac\web\chrome.py", line
146, in <lambda>
items.sort(lambda x,y: cmp(order.index(x[0]), order.index(y[0])))
ValueError: list.index(x): x not in list
}}}
This error comes from the fact that {{{navigation.items()}}} contains
statically defined items (categories: ''mainnav'' and ''metanav''). These
items are defined in {{{trac.ini}}}.
When the user adds a plugin that provides a navigation item, this item is
not automatically registered into the appropriate category. This makes the
sort method fail as the new navigation item is not part of the list.
Perharps this is not really a bug, if the plugin is expected to be
registered into the appropriate {{{trac.ini}}} ''[trac]'' section.
However, I don't understand why the same information is duplicated:
* in the plugin python code, where {{{get_navigation_items}}} should
return the navigation category as the first item
* in the {{{trac.ini}}} file, where it should be statically added to the
same navigation category
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/1571>
The Trac Project <>
More information about the Trac-Tickets
mailing list