Opened 18 years ago
Closed 18 years ago
#383 closed defect (fixed)
0.10-incompatibility: No TOCs on main wiki page, and preview mode oddities.
Reported by: | Owned by: | Alec Thomas | |
---|---|---|---|
Priority: | normal | Component: | TocMacro |
Severity: | normal | Keywords: | review |
Cc: | Trac Release: | 0.10 |
Description
TocMacro (0.9, checkouted from SVN) stopped working with latest Trac SVN r3326. When user visits http://site/wiki and TocMacro is in WikiStart, TOC is not displayed. However, TOC reappears when URL is corrected to http://site/wiki/WikiStart.
You can check the said behaviour on Hybserv Trac site. Compare the following URI:
TIA.
Attachments (0)
Change History (14)
comment:1 Changed 18 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 18 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Scratch that, not awake yet.
comment:3 Changed 18 years ago by
Interestingly, it's not the WikiStart bit of the URL that matters:
- http://www.hybserv.net/wiki <- fails
- http://www.hybserv.net/wiki/ <- works
comment:4 Changed 18 years ago by
Actually yes, you're right. I've later found out that '/' at the end of URL affects it to. And as a side bonus, whole TOC gets selected (that didn't use to work like that) :-)
comment:5 Changed 18 years ago by
Rather crude fix:
Index: macro.py =================================================================== --- macro.py (revision 867) +++ macro.py (working copy) @@ -106,6 +107,9 @@ if req.path_info.startswith('/wiki/'): current_page = req.path_info[6:] in_preview = True + elif req.path_info == '/wiki': + current_page = '/wiki/' + in_preview = True else: return ''
And actually that seems a Trac bug, since it doesn't set wiki.page_name..
comment:6 Changed 18 years ago by
Keywords: | review added |
---|
A different fix:
Index: tractoc/macro.py =================================================================== --- tractoc/macro.py (revision 871) +++ tractoc/macro.py (working copy) @@ -99,15 +99,9 @@ if 'macro_no_float' in req.hdf: return '' - # If this is a page preview, try to figure out where its from + # Find our invoking page, and whether we are a preview current_page = req.hdf.getValue('wiki.page_name','WikiStart') - in_preview = False - if not req.hdf.has_key('wiki.page_name'): - if req.path_info.startswith('/wiki/'): - current_page = req.path_info[6:] - in_preview = True - else: - return '' + in_preview = req.args.has_key('text') def get_page_text(pagename): """Return a tuple of (text, exists) for a page, taking into account previews."""
This won't work with 0.9, but seems a fairly clean way to work with 0.10.
The current semantics of 0.10 seem to be:
- Set
wiki.page_name
always (view and preview), except for _view_ ofWikiStart
. - Never set
wiki.action
in time for macros to see it - which would enable us to explicitly test whether we were previewing or not. Fortunately, we can manage an acceptable substitute by just checking to see ifreq.args['text']
exists.
comment:7 Changed 18 years ago by
Seems fairly clean. Too bad for backwards compatibility, though :/
comment:8 Changed 18 years ago by
There are 0.9 and 0.10 branches of most plugins and macros for that reason ;-)
comment:9 Changed 18 years ago by
Trac Release: | 0.9 → 0.10 |
---|
comment:10 Changed 18 years ago by
Summary: | Stopped working with trac trunk on main Wiki page → 0.10-incompatibility: No TOCs on main wiki page, and preview mode oddities. |
---|
Just as clarification, the symptoms being fixed here are:
- When accessed as
http://server/trac/wiki
orhttp://server/trac
, all TOCs are not rendered. - When accessed as
http://server/trac/wiki/WikiStart
, TOCs show a title but links. - Preview mode doesn't preview, it produces a TOC based on the unedited page contents.
comment:11 Changed 18 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Possibly fixed in [931]. Can someone test this out and reopen the ticket if needed?
comment:12 Changed 18 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Works? Weird.