On Tue, Mar 5, 2013 at 6:59 AM, Filipe Correia <[email protected]> wrote:

> I'm developing a plugin that implements IRequestHandler and
> INavigationContributor. My "process_request()" method calls
> "add_script()" a couple of times. For reasons I don't fully
> understand, the "get_active_navigation_item()" method gets called in
> these situations, but I'm assuming it's by design.
>
> Note that "process_request()" belongs to the IRequestHandler extension
> point, and "get_active_navigation_item()" belongs to the
> INavigationContributor extension point.
>
> The issue is, I need to implement these extensions points in two
> distinct Component classes. But when I split the Component class in
> two (one for each extension point) the "get_active_navigation_item()"
> is no longer called, so the item that I'm adding to the mainnav no
> longer shows highlighted...
>

This sounds a lot like http://trac.edgewall.org/ticket/9528.  There's an
explanation and a patch at
http://trac.edgewall.org/ticket/10953#comment:8(which has been closed
as a duplicate) -- the patch would solve this
problem, but causes some subtle side effects that may not be acceptable.

I haven't refreshed my memory lately, but I think the best/only workaround
is to delay your add_script() calls somehow until post_process_request(),
perhaps by setting some state on your component or on the request object
itself (but **not** on request.chrome!) during process_request() and then
checking for that state in post_process_request().

More eyes on #9528 would be great too, if you want to try coming up with a
better patch. :-)

-Ethan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to