Opened 15 years ago
Last modified 2 years ago
#9528 new defect
Failed to highlight active mainnav item if `RepositoryManager` is enabled
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | normal | Milestone: | next-stable-1.6.x |
| Component: | web frontend | Version: | 0.12 |
| Severity: | minor | Keywords: | mainnav RepositoryManager |
| Cc: | ethan.jucovy@…, ryan.j.ollos@…, fcorreia@…, leho@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
I am experiencing an odd behavior using Trac and ThemeEnginePlugin . The problem is that active CSS class is not added to active mainnav item. Everything works ok if I disable RepositoryManager . I've tried to find the exact location where the problem happens , but without success . The only things I can say so far are :
handlervar is set toNonewhen callingChrome.prepare_data…- … therefore
activevar is also set toNone, and item is not highlighted in mainnav … - … the strange fact is that at that time , the partial object has
already been installed for
chosen_handlerinsideRequestDispatcher.dispachsincereq.callbacks['chrome'].keywords.items()contains the correct binding forhandlerkey. - the signature of
RepositoryManager.post_process_requestispost_process_request(self, req, template, content_type), is it suitable to be used with Genshi templates ?
PS: Posted here 'cause I think there's a problem with Trac rather than the plugin .
Attachments (1)
Change History (19)
follow-up: 2 comment:1 by , 15 years ago
| Resolution: | → cantfix |
|---|---|
| Status: | new → closed |
follow-up: 3 comment:2 by , 15 years ago
| Resolution: | cantfix |
|---|---|
| Status: | closed → reopened |
Replying to cboos:
Is there a problem without the theme engine plugin? If yes, please reopen. Otherwise I'm afraid you're on your own.
The problem is that if a filter instantiates req.chrome inside pre_process_request then process_data is not wrapped using functools.partial, hence it doesn't receive active handler , and finally there's no mainnav highlighted.
comment:3 by , 15 years ago
Replying to anonymous:
Replying to cboos:
Is there a problem without the theme engine plugin? If yes, please reopen. Otherwise I'm afraid you're on your own.
The problem is that if a filter instantiates
req.chromeinsidepre_process_requestthenprocess_datais not wrapped usingfunctools.partial, hence it doesn't receive active handler , and finally there's nomainnavhighlighted.
… even if req.callbacks['chrome'].keywords.items() contains the correct binding for handler key , because that setup happened after instantiating chrome attribute .
comment:4 by , 15 years ago
| Component: | version control → web frontend |
|---|---|
| Milestone: | → next-minor-0.12.x |
| Severity: | normal → minor |
| Version: | → 0.12 |
Ok, seems worth having a look.
follow-up: 6 comment:5 by , 13 years ago
#10953 might be a duplicate. The issue that I think I'm seeing in that ticket is that the add_warning in RepositoryManager.pre_process_request causes the prepare_request callback to execute immediately with chosen_handler set to None.
comment:6 by , 13 years ago
Replying to Ryan J Ollos <ryan.j.ollos@…>:
#10953 might be a duplicate.
definitely yes . Ethan has submitted a patch explained here .
The issue that I think I'm seeing in that ticket is that the
add_warninginRepositoryManager.pre_process_requestcauses theprepare_requestcallback to execute immediately withchosen_handlerset toNone.
definitely right .
comment:7 by , 13 years ago
| Cc: | added |
|---|
by , 13 years ago
| Attachment: | t9528_r11480_ensure_lazy_chrome.diff added |
|---|
Patch: Trac #9528 : Ensure lazy instantiation of req.chrome
comment:8 by , 13 years ago
The only objection I have after reviewing Ethan's patch is that the side effects of its last hunk will imply that instantiation of req.chrome would never be lazy any more. Therefore I propose to apply attached patch on top of Ethan's . I've been doing such thing with the help of a local mercurial patch queue . Patch order is as follows :
$ hg qapplied trac/t9528/t10953-r11480-no-handler-in-chrome-prepare_request.diff trac/t9528/t9528_r11480_ensure_lazy_chrome.diff
Please review .
comment:9 by , 13 years ago
I've been taking a look once again and it seems to me that there are another issues with Ethan's patch :
- nav items won't be available if request dispatching never gets to the point
where
prepare_request_with_handleris invoked , included but not limited to- error raised in
_pre_process_request - no handler found
- error raised in
- extended version of
req.chromewon't be available while invokingchosen_handler.process_request?
comment:10 by , 13 years ago
| Cc: | added |
|---|
comment:11 by , 13 years ago
| Cc: | added |
|---|
comment:12 by , 13 years ago
| Cc: | added |
|---|
comment:13 by , 11 years ago
| Milestone: | next-minor-0.12.x → next-stable-1.0.x |
|---|
Moving this forward since I don't think it needs to be fixed on 0.12-stable, but please comment if you feel differently. Is anyone interested in providing a revised patch?
comment:14 by , 11 years ago
This is very annoying, I think it would be worth to have it for the next 0.12. Is the current patch now outdated?
comment:15 by , 10 years ago
| Status: | reopened → new |
|---|
comment:16 by , 9 years ago
| Milestone: | next-stable-1.0.x → next-stable-1.2.x |
|---|
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.
comment:17 by , 5 years ago
| Milestone: | next-stable-1.2.x → next-stable-1.4.x |
|---|



Is there a problem without the theme engine plugin? If yes, please reopen. Otherwise I'm afraid you're on your own.