/usr/share/pyshared/MoinMoin/macro/WikiConfig.py is in python-moinmoin 1.9.3-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - Wiki Configuration
"""
from MoinMoin.config import multiconfig
Dependencies = ['user'] # table headings are translated to user language
generates_headings = True
def macro_WikiConfig(macro):
request = macro.request
_ = request.getText
f = macro.request.formatter
ret = []
if not request.user or not request.user.isSuperUser():
return ''
settings = {}
for groupname in multiconfig.options:
heading, desc, opts = multiconfig.options[groupname]
for name, default, description in opts:
name = groupname + '_' + name
if isinstance(default, multiconfig.DefaultExpression):
default = default.value
settings[name] = default
for groupname in multiconfig.options_no_group_name:
heading, desc, opts = multiconfig.options_no_group_name[groupname]
for name, default, description in opts:
if isinstance(default, multiconfig.DefaultExpression):
default = default.value
settings[name] = default
ret.extend([
f.heading(1, 1, id='current_config'),
f.text(_("Wiki configuration")),
f.heading(0, 1),
f.paragraph(1),
_("This table shows all settings in this wiki that do not have default values. "
"Settings that the configuration system doesn't know about are shown in ''italic'', "
"those may be due to third-party extensions needing configuration or settings that "
"were removed from Moin.",
wiki=True),
f.paragraph(0),
])
ret.extend([
f.table(1),
f.table_row(1),
f.table_cell(1), f.strong(1), f.text(_('Variable name')), f.strong(0), f.table_cell(0),
f.table_cell(1), f.strong(1), f.text(_('Setting')), f.strong(0), f.table_cell(0),
f.table_row(0),
])
def iter_vnames(cfg):
dedup = {}
for name in cfg.__dict__:
dedup[name] = True
yield name, cfg.__dict__[name]
for cls in cfg.__class__.mro():
if cls == multiconfig.ConfigFunctionality:
break
for name in cls.__dict__:
if not name in dedup:
dedup[name] = True
yield name, cls.__dict__[name]
found = []
for vname, value in iter_vnames(request.cfg):
if hasattr(multiconfig.ConfigFunctionality, vname):
continue
if vname in settings and settings[vname] == value:
continue
found.append((vname, value))
found.sort()
for vname, value in found:
vname = f.text(vname)
if not vname in settings:
vname = f.emphasis(1) + vname + f.emphasis(0)
vtxt = '%r' % (value, )
ret.extend([
f.table_row(1),
f.table_cell(1), vname, f.table_cell(0),
f.table_cell(1), f.code(1, css="backtick"), f.text(vtxt), f.code(0), f.table_cell(0),
f.table_row(0),
])
ret.append(f.table(0))
return ''.join(ret)
|