Opened 18 years ago
Closed 18 years ago
#3294 closed defect (fixed)
[PATCH] Trac fails to set HDF var `wiki.page_name` when viewing `WikiStart` page
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | wiki system | Version: | devel |
Severity: | trivial | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Trac fails to set the HDF variable wiki.page_name
when viewing the WikiStart
page.
This can trip up plugins such as wiki macros, or force them to insert an unnecessary special case.
The problem occurs because code in trac/wiki/web_ui.py tries to re-implement the _set_title
function as a special case for WikiStart
, and omits part of the functionality (setting wiki.page_name
). The fix is to simply make use of _set_title
unconditionally, and then tweak the results as a special case for WikiStart
:
Index: trac/wiki/web_ui.py =================================================================== --- trac/wiki/web_ui.py (revision 3431) +++ trac/wiki/web_ui.py (working copy) @@ -398,11 +398,9 @@ def _render_view(self, req, db, page): req.perm.assert_permission('WIKI_VIEW') + page_name = self._set_title(req, page, '') if page.name == 'WikiStart': req.hdf['title'] = '' - page_name = 'WikiStart' - else: - page_name = self._set_title(req, page, '') version = req.args.get('version') if version:
Attachments (0)
Change History (2)
comment:1 by , 18 years ago
Milestone: | 0.10 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 18 years ago
Milestone: | → 0.10 |
---|---|
Resolution: | → fixed |
Severity: | normal → trivial |
Status: | assigned → closed |
Patch applied in r3432, as it simplifies the code a bit.
But again, don't rely on wiki.page_name
for the TracHAcks:TocMacro.
The problem with using the HDF's
wiki.page_name
for retrieving the page name is that you'll get either "WikiStart" or "Wiki Start", depending on the value of the[wiki] split_page_names
option.A more reliable way to get that information in milestone:0.10 would be to parse the value of the HDF's
wiki.current_href
key: