Skip to content

wikiconfig.py: "trailing / below causes foo to be stored in default backend" #1649

@RogerHaase

Description

@RogerHaase

From wikiconfig.py line ~156:

    # define custom namespaces if desired, trailing / below causes foo to be stored in default backend
    # 'foo/': 'default',

The trailing / is wrong, but worked OK until the fix for #1446 was applied where line ~1226

if revid is not None and revid in backend:

was replaced by:

        backend_name = dict(app.cfg.namespace_mapping)[meta.get(NAMESPACE, '')]
        if revid is not None and (revid in backend or (backend_name, revid) in backend):

The new code fails because meta.get(NAMESPACE) = 'foo' and app.cfg.namespace_mapping has a key "foo/" but not a key "foo".

Traceback (most recent call last):
-- snip --
  File "C:\GIT\moin\src\moin\items\__init__.py", line 1059, in _save
    fqname, new_meta = storage_item.store_revision(meta, data,
  File "C:\GIT\moin\src\moin\storage\middleware\protecting.py", line 412, in store_revision
    rev = self.item.store_revision(meta, data, overwrite=overwrite, return_rev=return_rev, fqname=fqname, **kw)
  File "C:\GIT\moin\src\moin\storage\middleware\indexing.py", line 1262, in store_revision
    backend_name = dict(app.cfg.namespace_mapping)[meta.get(NAMESPACE, '')]
KeyError: 'foo'

The fix is to remove the trailing /

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions