Skip to content

Commit 861610e

Browse files
authored
Merge pull request #2003 from roland-ruedenauer/fix-wiki-root
Fix code accessing the no longer existing configuration setting 'item_root'
2 parents e5aa7c3 + da15b44 commit 861610e

File tree

9 files changed

+11
-12
lines changed

9 files changed

+11
-12
lines changed

docs/admin/configure.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ To configure custom namespaces, find the section in wikiconfig.py that looks sim
14541454
hierarchic=False, ),
14551455
}
14561456
namespace_mapping, backend_mapping, acl_mapping = create_mapping(uri, namespaces, backends, acls, )
1457-
# define mapping of namespaces to unique item_roots (home pages within namespaces).
1457+
# define mapping of namespaces to unique root items (home pages within namespaces).
14581458
root_mapping = {'users': 'UserHome', }
14591459
# default root, use this value by default for all namespaces
14601460
default_root = 'Home'
@@ -1616,4 +1616,4 @@ Make sure to use an absolute path that points to a valid logging configuration f
16161616
**Important:**
16171617
The logging configuration must be stored in a **separate file** — do **not** place it inside your `wikiconfig.py`.
16181618

1619-
If no configuration is provided, or if the provided configuration file cannot be loaded, Moin will fall back to a built-in default configuration, which logs to `stderr` at the `INFO` level.
1619+
If no configuration is provided, or if the provided configuration file cannot be loaded, Moin will fall back to a built-in default configuration, which logs to `stderr` at the `INFO` level.

src/moin/_tests/wikiconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Config(DefaultConfig):
2525
data_dir = join(_here, "wiki", "data") # needed for plugins package TODO
2626
index_storage = "FileStorage", (join(_here, "wiki", "index"),), {}
2727
default_acl = None
28-
item_root = "FrontPage"
28+
default_root = "FrontPage"
2929
interwikiname = "MoinTest"
3030
interwiki_map = dict(Self="http://localhost:8080/", MoinMoin="http://moinmo.in/")
3131
interwiki_map[interwikiname] = "http://localhost:8080/"

src/moin/config/default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def __init__(self, exprstr):
546546
"Home",
547547
"Default root, use this value in case no match is found in root_mapping. [Unicode]",
548548
),
549-
("root_mapping", {}, "mapping of namespaces to item_roots."),
549+
("root_mapping", {}, "mapping of namespaces to unique root items."),
550550
# the following regexes should match the complete name when used in free text
551551
# the group 'all' shall match all, while the group 'key' shall match the key only
552552
# e.g. FooGroup -> group 'all' == FooGroup, group 'key' == Foo

src/moin/config/wikiconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class Config(DefaultConfig):
236236
# TODO If there is a future change that requires wiki admins to merge this wikiconfig with the customized wikiconfig
237237
# then remove the "uri" parameter in create mapping below and in storage/__init__.py.
238238
namespace_mapping, backend_mapping, acl_mapping = create_mapping(uri, namespaces, backends, acls)
239-
# define mapping of namespaces to unique item_roots (home pages within namespaces).
239+
# define mapping of namespaces to unique root items (home pages within namespaces).
240240
root_mapping = {"users": "UserHome"}
241241
# default root, use this value by default for all namespaces
242242
default_root = "Home"

src/moin/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{{ utils.user_login_logoff() }}
3131
</ul>
3232
{% if cfg.sitename %}
33-
<a class="moin-sitename" href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
33+
<a class="moin-sitename" href="{{ url_for('frontend.show_item', item_name=cfg.default_root) }}">
3434
{{ cfg.sitename }}
3535
</a>
3636
{% endif %}

src/moin/themes/basic/templates/layout.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<header class="moin-sidebar flex-grow-0" lang="{{ theme_supp.user_lang }}" dir="{{ theme_supp.user_dir }}">
7575
<div class="moin-logo">
7676
{% if logo %}
77-
<a href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
77+
<a href="{{ url_for('frontend.show_item', item_name=cfg.root_mapping.get('', cfg.default_root)) }}">
7878
{{ logo }}
7979
</a>
8080
{% endif %}
@@ -131,7 +131,7 @@
131131
</button>
132132

133133
{% if cfg.sitename %}
134-
<a class="navbar-brand" href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
134+
<a class="navbar-brand" href="{{ url_for('frontend.show_item', item_name=cfg.default_root) }}">
135135
{{ cfg.sitename }}
136136
</a>
137137
{% endif %}

src/moin/themes/focus/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</div>
2626
{% endif %}
2727
{% if cfg.sitename %}
28-
<a class="moin-sitename" href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
28+
<a class="moin-sitename" href="{{ url_for('frontend.show_item', item_name=cfg.default_root) }}">
2929
{{ cfg.sitename }}
3030
</a>
3131
{% endif %}

src/moin/themes/topside/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</div>
2323
{%- endif %}
2424
{%- if cfg.sitename %}
25-
<a class="moin-sitename" href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
25+
<a class="moin-sitename" href="{{ url_for('frontend.show_item', item_name=cfg.default_root) }}">
2626
{{ cfg.sitename }}
2727
</a>
2828
{%- endif %}

src/moin/utils/interwiki.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ def query(self):
190190

191191
def get_root_fqname(self):
192192
"""
193-
Set value to the item_root of that namespace, and return
194-
the new CompositeName.
193+
Determine the root item of the namespace of this composite name and return it as new CompositeName instance.
195194
"""
196195
return CompositeName(self.namespace, NAME_EXACT, app.cfg.root_mapping.get(self.namespace, app.cfg.default_root))
197196

0 commit comments

Comments
 (0)