Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unwanted foo/ from wikiconfig.py examples; fixes #1649 #1650

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/admin/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1398,11 +1398,11 @@ To configure custom namespaces, find the section in wikiconfig.py that looks sim
NAMESPACE_USERS: 'users',
NAMESPACE_USERPROFILES: 'userprofiles',
# namespaces for editor help files are optional, if unwanted delete here and in backends and acls
'help-common': 'help-common', # contains media files used by other language helps
'help-en': 'help-en', # replace this with help-de, help-ru, help-pt_BR etc.
# define custom namespaces if desired, trailing / below causes foo to be stored in default backend
# 'foo/': 'default',
# custom namespace with a separate backend - note absence of trailing /
NAMESPACE_HELP_COMMON: 'help-common', # contains media files used by other language helps
NAMESPACE_HELP_EN: 'help-en', # replace this with help-de, help-ru, help-pt_BR etc.
# define custom namespaces using the default backend
# 'foo': 'default',
# custom namespace with a separate backend (a wiki/data/bar directory will be created)
# 'bar': 'bar',
}
backends = {
Expand Down
16 changes: 9 additions & 7 deletions src/moin/config/wikiconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
from moin.config.default import DefaultConfig
from moin.utils.interwiki import InterWikiMap
from moin.storage import create_mapping
from moin.constants.namespaces import NAMESPACE_DEFAULT, NAMESPACE_USERPROFILES, NAMESPACE_USERS
from moin.constants.namespaces import NAMESPACE_DEFAULT, NAMESPACE_USERPROFILES,NAMESPACE_USERS, \
NAMESPACE_HELP_COMMON, NAMESPACE_HELP_EN, NAMESPACE_ALL


class Config(DefaultConfig):
Expand Down Expand Up @@ -150,11 +151,11 @@ class Config(DefaultConfig):
NAMESPACE_USERS: 'users',
NAMESPACE_USERPROFILES: 'userprofiles',
# namespaces for editor help files are optional, if unwanted delete here and in backends and acls
'help-common': 'help-common', # contains media files used by other language helps
'help-en': 'help-en', # replace this with help-de, help-ru, help-pt_BR etc.
# define custom namespaces if desired, trailing / below causes foo to be stored in default backend
# 'foo/': 'default',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind that was that pages starting with foo/ (== subpages of foo) are stored in that namespace.

If you remove the slash, page foobar and fool will also be stored into that namespace.

Except if there was a code change that auto-appends a slash. Is that the case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing / was from /storage/__init__.py create_simple_mapping #563 when wikiconfig.py used create_simple_mapping. The trailing / is no longer in the docs https://moin-20.readthedocs.io/en/latest/admin/configure.html#create-simple-mapping but lived on in code comments.

wikiconfig.py now uses create_mapping per #1237 which allows admins to create custom namespaces.

namespaces = {
    # maps namespace name -> backend name
    # first, configure the required, standard namespaces:
    NAMESPACE_DEFAULT: 'default',
    - snip -
    # some additional custom namespaces stored in default backend:
    'foo': 'default',
    'bar': 'default',
    # custom namespace with a backend
    'baz': 'baz',
}

There were 2 code changes, trailing / was removed from create_simple_mapping, and wikiconfig.py changed to use create_mapping.

# custom namespace with a separate backend - note absence of trailing /
NAMESPACE_HELP_COMMON: 'help-common', # contains media files used by other language helps
NAMESPACE_HELP_EN: 'help-en', # replace this with help-de, help-ru, help-pt_BR etc.
# define custom namespaces using the default backend
# 'foo': 'default',
# custom namespace with a separate backend (a wiki/data/bar directory will be created)
# 'bar': 'bar',
}
backends = {
Expand All @@ -168,7 +169,8 @@ class Config(DefaultConfig):
# help namespaces are optional
'help-common': None,
'help-en': None,
# required for bar namespace if defined above
# required for foo and bar namespaces as defined above
# 'foo': None,
# 'bar': None,
}
acls = {
Expand Down