#9487 closed enhancement (fixed)
Control the default wiki page through trac.ini
| Reported by: | a-h | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3.2 |
| Component: | wiki system | Version: | 0.12 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: |
Extracted variables in |
||
| Internal Changes: | |||
Description (last modified by )
Hello,
Here's a way to change the default wiki page:
-
web_ui.
old new 107 107 108 108 def process_request(self, req): 109 109 action = req.args.get('action', 'view') 110 pagename = req.args.get('page', 'WikiStart') 110 pagename = req.args.get('page', 111 self.env.config['wiki'].get('default_page') 112 or 'WikiStart') 111 113 version = req.args.get('version') 112 114 old_version = req.args.get('old_version')
Attachments (0)
Change History (13)
comment:1 by , 15 years ago
| Description: | modified (diff) |
|---|---|
| Milestone: | → unscheduled |
comment:4 by , 9 years ago
Closed #10595 as a duplicate. This ticket, if implemented, can also make customizable the location pointed to be TitleIndex.
comment:5 by , 9 years ago
| Milestone: | unscheduled → 1.3.2 |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
Since this is probably rarely customized, we could just extract variables like we did for default_tracker (comment:1:ticket:10898): [98dd2d30/rjollos.git].
# -*- coding: utf-8 -*- from trac.wiki import web_ui web_ui.WikiModule.START_PAGE = 'Trac/WikiStart' web_ui.WikiModule.TITLE_INDEX = 'Trac/TitleIndex'
comment:6 by , 9 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Committed to trunk in r15818.
comment:7 by , 9 years ago
At least, WikiStart is still remained at two locations:
mirror/trunk:trac/wiki/api.py: pagename = pagename.rstrip('/') or 'WikiStart'
mirror/trunk:trac/wiki/templates/wiki_page_path.html:<a class="pathentry first" title="${_('View WikiStart')}"
$ git grep -w WikiStart mirror/trunk -- '*.py' '*.html' | egrep -v '/test(\.py|s/)'
mirror/trunk:contrib/checkwiki.py: if name in ('SandBox', 'TitleIndex', 'WikiStart'):
mirror/trunk:contrib/help_guide_version_notice.py: 'TitleIndex, SandBox, WikiStart',
mirror/trunk:trac/mimeview/api.py: >>> context = RenderingContext('wiki', 'WikiStart')
mirror/trunk:trac/perm.py: 'WIKI_MODIFY' in perm('wiki', 'WikiStart')
mirror/trunk:trac/perm.py: perm('wiki', 'WikiStart').require('WIKI_MODIFY')
mirror/trunk:trac/resource.py: >>> main = Resource('wiki', 'WikiStart')
mirror/trunk:trac/resource.py: "<Resource u'wiki:WikiStart'>"
mirror/trunk:trac/resource.py: "<Resource u'wiki:WikiStart@3'>"
mirror/trunk:trac/resource.py: "<Resource u'wiki:WikiStart@0'>"
mirror/trunk:trac/web/chrome.py: The following example renames the link to WikiStart to //Home//,
mirror/trunk:trac/wiki/admin.py: ignore=['WikiStart'], create_only=['InterMapTxt'])
mirror/trunk:trac/wiki/api.py: pagename = pagename.rstrip('/') or 'WikiStart'
mirror/trunk:trac/wiki/api.py: >>> main = Resource('wiki', 'WikiStart')
mirror/trunk:trac/wiki/api.py: 'WikiStart'
mirror/trunk:trac/wiki/api.py: 'WikiStart'
mirror/trunk:trac/wiki/api.py: 'WikiStart'
mirror/trunk:trac/wiki/api.py: >>> resource_exists(env, Resource('wiki', 'WikiStart'))
mirror/trunk:trac/wiki/api.py: >>> main = WikiPage(env, 'WikiStart')
mirror/trunk:trac/wiki/templates/wiki_page_path.html:<a class="pathentry first" title="${_('View WikiStart')}"
mirror/trunk:trac/wiki/web_ui.py: START_PAGE = 'WikiStart'
mirror/trunk:tracopt/perm/authz_policy.py: Example: Match the WikiStart page::
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart*]
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart@*]
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart]
mirror/trunk:tracopt/perm/authz_policy.py: ``wiki:WikiStart@117/attachment/FOO.JPG@*`` on WikiStart::
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart*]
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart@*]
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart@*/attachment/*]
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart@117/attachment/FOO.JPG]
mirror/trunk:tracopt/perm/authz_policy.py: [wiki:WikiStart@*]
comment:8 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:10 by , 9 years ago
IMO, I'd like to avoid to set values to class attribute in instance method __init__. How about using property() like this?
-
trac/wiki/web_ui.py
diff --git a/trac/wiki/web_ui.py b/trac/wiki/web_ui.py index b1bcbf61b..266144cbb 100644
a b class WikiModule(Component): 62 62 """Default height of the textarea on the wiki edit page. 63 63 (//Since 1.1.5//)""") 64 64 65 START_PAGE = None66 TITLE_INDEX_PAGE = None65 START_PAGE = property(lambda self: WikiSystem.START_PAGE) 66 TITLE_INDEX_PAGE = property(lambda self: WikiSystem.TITLE_INDEX_PAGE) 67 67 PAGE_TEMPLATES_PREFIX = 'PageTemplates/' 68 68 DEFAULT_PAGE_TEMPLATE = 'DefaultPage' 69 69 70 def __init__(self):71 self.__class__.START_PAGE = WikiSystem.START_PAGE72 self.__class__.TITLE_INDEX_PAGE = WikiSystem.TITLE_INDEX_PAGE73 74 70 # IContentConverter methods 75 71 76 72 def get_supported_conversions(self):
comment:11 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
That looks good. Committed to trunk in r15822.
Revised plugin is:
# -*- coding: utf-8 -*- from trac.wiki import api api.WikiSystem.START_PAGE = 'Trac/WikiStart' api.WikiSystem.TITLE_INDEX_PAGE = 'Trac/TitleIndex'
comment:12 by , 9 years ago
Related, there are no permission checks done before adding the contextual navigation items: tags/trac-1.2.1/trac/wiki/web_ui.py@:728,729#L726. Fixed on 1.2-stable in r15851, merged to trunk in r15852.



Unfortunately, it's not quite that simple. The name "WikiStart" is hard-coded at various locations, e.g. for re-directing after deleting a page. I think there was even a more complete patch for this, but my search-fu seems to be severely lacking lately. I thought it was part of #1106, but no luck.