1
# -*- coding: iso-8859-1 -*-
3
MoinMoin - Wiki Configuration
5
from MoinMoin.config import multiconfig
7
Dependencies = ['user'] # table headings are translated to user language
8
generates_headings = True
10
def macro_WikiConfig(macro):
11
request = macro.request
13
f = macro.request.formatter
16
if not request.user or not request.user.isSuperUser():
20
for groupname in multiconfig.options:
21
heading, desc, opts = multiconfig.options[groupname]
22
for name, default, description in opts:
23
name = groupname + '_' + name
24
if isinstance(default, multiconfig.DefaultExpression):
25
default = default.value
26
settings[name] = default
27
for groupname in multiconfig.options_no_group_name:
28
heading, desc, opts = multiconfig.options_no_group_name[groupname]
29
for name, default, description in opts:
30
if isinstance(default, multiconfig.DefaultExpression):
31
default = default.value
32
settings[name] = default
35
f.heading(1, 1, id='current_config'),
36
f.text(_("Wiki configuration")),
39
_("This table shows all settings in this wiki that do not have default values. "
40
"Settings that the configuration system doesn't know about are shown in ''italic'', "
41
"those may be due to third-party extensions needing configuration or settings that "
42
"were removed from Moin.",
49
f.table_cell(1), f.strong(1), f.text(_('Variable name')), f.strong(0), f.table_cell(0),
50
f.table_cell(1), f.strong(1), f.text(_('Setting')), f.strong(0), f.table_cell(0),
56
for name in cfg.__dict__:
58
yield name, cfg.__dict__[name]
59
for cls in cfg.__class__.mro():
60
if cls == multiconfig.ConfigFunctionality:
62
for name in cls.__dict__:
65
yield name, cls.__dict__[name]
68
for vname, value in iter_vnames(request.cfg):
69
if hasattr(multiconfig.ConfigFunctionality, vname):
71
if vname in settings and settings[vname] == value:
73
found.append((vname, value))
75
for vname, value in found:
77
if not vname in settings:
78
vname = f.emphasis(1) + vname + f.emphasis(0)
79
vtxt = '%r' % (value, )
82
f.table_cell(1), vname, f.table_cell(0),
83
f.table_cell(1), f.code(1, css="backtick"), f.text(vtxt), f.code(0), f.table_cell(0),
86
ret.append(f.table(0))