annotate MoinMoin/config/multiconfig.py @ 5998:603cb1f82ae1 default tip

CopyPage action: fix NameError exception when TextCha was answered wrong
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 15 Jul 2013 19:19:17 +0200
parents 50e82729b826
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1 # -*- coding: iso-8859-1 -*-
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
2 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
3 MoinMoin - Multiple configuration handler and Configuration defaults class
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1868
diff changeset
5 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
3126
fac1b1e9ea95 multiconfig: better logging, tell path of config that is used
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3120
diff changeset
6 2005-2008 MoinMoin:ThomasWaldmann.
3783
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
7 2008 MoinMoin:JohannesBerg
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
8 @license: GNU GPL, see COPYING for details.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
9 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
10
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
11 import re
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
12 import os
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
13 import sys
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
14 import time
3107
c6e39279f83b refactor logging usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3097
diff changeset
15
3110
a48929a5036c logging: make it work correctly by doing logging configuration very early
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3107
diff changeset
16 from MoinMoin import log
a48929a5036c logging: make it work correctly by doing logging configuration very early
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3107
diff changeset
17 logging = log.getLogger(__name__)
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
18
4212
1ca179133f01 Fix tests: small fixes after merge
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4210
diff changeset
19 from MoinMoin import config, error, util, wikiutil, web
4863
69073f6b028a Groups2009: Dicts and groups values are defined in the config.multiconfig. _tests.wikiconfig_groups was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4737
diff changeset
20 from MoinMoin import datastruct
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
21 from MoinMoin.auth import MoinAuth
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
22 import MoinMoin.auth as authmodule
2307
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
23 import MoinMoin.events as events
2429
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
24 from MoinMoin.events import PageChangedEvent, PageRenamedEvent
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
25 from MoinMoin.events import PageDeletedEvent, PageCopiedEvent
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
26 from MoinMoin.events import PageRevertedEvent, FileAttachedEvent
4212
1ca179133f01 Fix tests: small fixes after merge
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4210
diff changeset
27 import MoinMoin.web.session
1096
33927b0256ce Changed marshalling format of the full IWID, load full IWID into the RemoteWiki object.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1080
diff changeset
28 from MoinMoin.packages import packLine
1276
7c29a18a7e26 more memory efficient and faster ACL processing, do not have before/after/default acl in ACL object, but only once in cfg
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1212
diff changeset
29 from MoinMoin.security import AccessControlList
2595
5e7b45489430 moved python2.3/2.4 compatibility code to MoinMoin.support.python_compatibility (thanks to Heinrich Wendel)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2491
diff changeset
30 from MoinMoin.support.python_compatibility import set
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
31
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
32 _url_re_cache = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
33 _farmconfig_mtime = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
34 _config_cache = {}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
35
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
36
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
37 def _importConfigModule(name):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
38 """ Import and return configuration module and its modification time
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
39
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
40 Handle all errors except ImportError, because missing file is not
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
41 always an error.
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
42
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
43 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
44 @rtype: tuple
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
45 @return: module, modification time
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
46 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
47 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
48 module = __import__(name, globals(), {})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
49 mtime = os.path.getmtime(module.__file__)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
50 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
51 raise
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
52 except IndentationError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
53 logging.exception('Your source code / config file is not correctly indented!')
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
54 msg = """IndentationError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
55
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
56 The configuration files are Python modules. Therefore, whitespace is
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
57 important. Make sure that you use only spaces, no tabs are allowed here!
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
58 You have to use four spaces at the beginning of the line mostly.
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
59 """ % {
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
60 'err': err,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
61 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
62 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
63 except Exception, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
64 logging.exception('An exception happened.')
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
65 msg = '%s: %s' % (err.__class__.__name__, str(err))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
66 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
67 return module, mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
68
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
69
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
70 def _url_re_list():
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
71 """ Return url matching regular expression
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
72
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
73 Import wikis list from farmconfig on the first call and compile the
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
74 regexes. Later just return the cached regex list.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
75
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
76 @rtype: list of tuples of (name, compiled re object)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
77 @return: url to wiki config name matching list
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
78 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
79 global _url_re_cache, _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
80 if _url_re_cache is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
81 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
82 farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig')
3626
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
83 except ImportError, err:
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
84 if 'farmconfig' in str(err):
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
85 # we failed importing farmconfig
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
86 logging.debug("could not import farmconfig, mapping all URLs to wikiconfig")
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
87 _farmconfig_mtime = 0
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
88 _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
89 else:
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
90 # maybe there was a failing import statement inside farmconfig
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
91 raise
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
92 else:
3129
d57fed1b0b43 multiconfig: also log which farmconfig we use
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3126
diff changeset
93 logging.info("using farm config: %s" % os.path.abspath(farmconfig.__file__))
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
94 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
95 cache = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
96 for name, regex in farmconfig.wikis:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
97 cache.append((name, re.compile(regex)))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
98 _url_re_cache = cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
99 except AttributeError:
3126
fac1b1e9ea95 multiconfig: better logging, tell path of config that is used
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3120
diff changeset
100 logging.error("required 'wikis' list missing in farmconfig")
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
101 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
102 Missing required 'wikis' list in 'farmconfig.py'.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
103
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
104 If you run a single wiki you do not need farmconfig.py. Delete it and
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
105 use wikiconfig.py.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
106 """
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
107 raise error.ConfigurationError(msg)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
108 return _url_re_cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
109
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
110
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
111 def _makeConfig(name):
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
112 """ Create and return a config instance
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
113
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
114 Timestamp config with either module mtime or farmconfig mtime. This
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
115 mtime can be used later to invalidate older caches.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
116
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
117 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
118 @rtype: DefaultConfig sub class instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
119 @return: new configuration instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
120 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
121 global _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
122 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
123 module, mtime = _importConfigModule(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
124 configClass = getattr(module, 'Config')
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
125 cfg = configClass(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
126 cfg.cfg_mtime = max(mtime, _farmconfig_mtime)
3129
d57fed1b0b43 multiconfig: also log which farmconfig we use
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3126
diff changeset
127 logging.info("using wiki config: %s" % os.path.abspath(module.__file__))
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
128 except ImportError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
129 logging.exception('Could not import.')
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
130 msg = """ImportError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
131
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
132 Check that the file is in the same directory as the server script. If
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
133 it is not, you must add the path of the directory where the file is
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
134 located to the python path in the server script. See the comments at
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
135 the top of the server script.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
136
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
137 Check that the configuration file name is either "wikiconfig.py" or the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
138 module name specified in the wikis list in farmconfig.py. Note that the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
139 module name does not include the ".py" suffix.
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
140 """ % {
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
141 'err': err,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
142 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
143 raise error.ConfigurationError(msg)
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
144 except AttributeError, err:
5887
b397401dda7f fix typos, correct is: 'occurred'
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5883
diff changeset
145 logging.exception('An exception occurred.')
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
146 msg = """AttributeError: %(err)s
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
147
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
148 Could not find required "Config" class in "%(name)s.py".
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
149
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
150 This might happen if you are trying to use a pre 1.3 configuration file, or
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
151 made a syntax or spelling error.
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
152
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
153 Another reason for this could be a name clash. It is not possible to have
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
154 config names like e.g. stats.py - because that collides with MoinMoin/stats/ -
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
155 have a look into your MoinMoin code directory what other names are NOT
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
156 possible.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
157
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
158 Please check your configuration file. As an example for correct syntax,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
159 use the wikiconfig.py file from the distribution.
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
160 """ % {
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
161 'name': name,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
162 'err': err,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
163 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
164 raise error.ConfigurationError(msg)
2009
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
165
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
166 return cfg
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
167
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
168
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
169 def _getConfigName(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
170 """ Return config name for url or raise """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
171 for name, regex in _url_re_list():
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
172 match = regex.match(url)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
173 if match:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
174 return name
1575
45f876b6a109 raise NoConfigMatchedError
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1573
diff changeset
175 raise error.NoConfigMatchedError
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
176
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
177
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
178 def getConfig(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
179 """ Return cached config instance for url or create new one
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
180
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
181 If called by many threads in the same time multiple config
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
182 instances might be created. The first created item will be
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
183 returned, using dict.setdefault.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
184
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
185 @param url: the url from request, possibly matching specific wiki
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
186 @rtype: DefaultConfig subclass instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
187 @return: config object for specific wiki
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
188 """
1582
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1575
diff changeset
189 cfgName = _getConfigName(url)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
190 try:
1582
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1575
diff changeset
191 cfg = _config_cache[cfgName]
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
192 except KeyError:
1582
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1575
diff changeset
193 cfg = _makeConfig(cfgName)
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1575
diff changeset
194 cfg = _config_cache.setdefault(cfgName, cfg)
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1575
diff changeset
195 return cfg
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
196
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
197
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
198 # This is a way to mark some text for the gettext tools so that they don't
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
199 # get orphaned. See http://www.python.org/doc/current/lib/node278.html.
1920
b06ef2a53efa 'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
200 def _(text):
b06ef2a53efa 'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
201 return text
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
202
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
203
1549
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
204 class CacheClass:
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
205 """ just a container for stuff we cache """
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
206 pass
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
207
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
208
3763
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
209 class ConfigFunctionality(object):
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
210 """ Configuration base class with config class behaviour.
3485
aff01569df82 make sourcecode pep8 test happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3483
diff changeset
211
3763
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
212 This class contains the functionality for the DefaultConfig
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
213 class for the benefit of the WikiConfig macro.
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
214 """
1597
bbe187af4fc0 integrated MMDE (build scripts need more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
215
3783
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
216 # attributes of this class that should not be shown
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
217 # in the WikiConfig() macro.
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
218 cfg_mtime = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
219 siteid = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
220 cache = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
221 mail_enabled = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
222 jabber_enabled = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
223 auth_can_logout = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
224 auth_have_login = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
225 auth_login_inputs = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
226 _site_plugin_lists = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
227 _iwid = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
228 _iwid_full = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
229 xapian_searchers = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
230 moinmoin_dir = None
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
231 # will be lazily loaded by interwiki code when needed (?)
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
232 shared_intermap_files = None
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
233
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
234 def __init__(self, siteid):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
235 """ Init Config instance """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
236 self.siteid = siteid
1549
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
237 self.cache = CacheClass()
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
238
1624
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
239 from MoinMoin.Page import ItemCache
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
240 self.cache.meta = ItemCache('meta')
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
241 self.cache.pagelists = ItemCache('pagelists')
1620
a86f20280204 implement and use ItemMetaDataCache
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1615
diff changeset
242
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
243 if self.config_check_enabled:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
244 self._config_check()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
245
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
246 # define directories
1011
58f5af49cd03 move config and multiconfig to config/ package, see HINT in CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 932
diff changeset
247 self.moinmoin_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
248 data_dir = os.path.normpath(self.data_dir)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
249 self.data_dir = data_dir
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
250 for dirname in ('user', 'cache', 'plugin'):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
251 name = dirname + '_dir'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
252 if not getattr(self, name, None):
1929
aa6aa944246b introduce per-user and per-session secrets that are used for the cookie
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1920
diff changeset
253 setattr(self, name, os.path.abspath(os.path.join(data_dir, dirname)))
4531
83666cc9dc31 new cfg.session_dir setting, store sessions into cache_dir/__session__ by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4530
diff changeset
254 # directories below cache_dir (using __dirname__ to avoid conflicts)
83666cc9dc31 new cfg.session_dir setting, store sessions into cache_dir/__session__ by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4530
diff changeset
255 for dirname in ('session', ):
83666cc9dc31 new cfg.session_dir setting, store sessions into cache_dir/__session__ by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4530
diff changeset
256 name = dirname + '_dir'
83666cc9dc31 new cfg.session_dir setting, store sessions into cache_dir/__session__ by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4530
diff changeset
257 if not getattr(self, name, None):
83666cc9dc31 new cfg.session_dir setting, store sessions into cache_dir/__session__ by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4530
diff changeset
258 setattr(self, name, os.path.abspath(os.path.join(self.cache_dir, '__%s__' % dirname)))
855
481c72d4a181 support for common indices directory cfg.xapian_index_dir
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 838
diff changeset
259
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
260 # Try to decode certain names which allow unicode
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
261 self._decode()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
262
1549
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
263 # After that, pre-compile some regexes
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
264 self.cache.page_category_regex = re.compile(self.page_category_regex, re.UNICODE)
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
265 self.cache.page_dict_regex = re.compile(self.page_dict_regex, re.UNICODE)
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
266 self.cache.page_group_regex = re.compile(self.page_group_regex, re.UNICODE)
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
267 self.cache.page_template_regex = re.compile(self.page_template_regex, re.UNICODE)
3573
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
268
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
269 # the ..._regexact versions only match if nothing is left (exact match)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
270 self.cache.page_category_regexact = re.compile(u'^%s$' % self.page_category_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
271 self.cache.page_dict_regexact = re.compile(u'^%s$' % self.page_dict_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
272 self.cache.page_group_regexact = re.compile(u'^%s$' % self.page_group_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
273 self.cache.page_template_regexact = re.compile(u'^%s$' % self.page_template_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
274
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
275 self.cache.ua_spiders = self.ua_spiders and re.compile(self.ua_spiders, re.IGNORECASE)
1549
e36313297589 introduce request.cfg.cache object, start using it for some precompiled regexes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1548
diff changeset
276
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
277 self._check_directories()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
278
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
279 if not isinstance(self.superuser, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
280 msg = """The superuser setting in your wiki configuration is not a list
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
281 (e.g. ['Sample User', 'AnotherUser']).
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
282 Please change it in your wiki configuration and try again."""
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
283 raise error.ConfigurationError(msg)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
284
5418
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
285 # moin < 1.9 used cookie_lifetime = <float> (but converted it to int) for logged-in users and
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
286 # anonymous_session_lifetime = <float> or None for anon users
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
287 # moin >= 1.9 uses cookie_lifetime = (<float>, <float>) - first is anon, second is logged-in
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
288 if not (isinstance(self.cookie_lifetime, tuple) and len(self.cookie_lifetime) == 2):
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
289 logging.error("wiki configuration has an invalid setting: " +
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
290 "cookie_lifetime = %r" % (self.cookie_lifetime, ))
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
291 try:
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
292 anon_lifetime = self.anonymous_session_lifetime
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
293 logging.warning("wiki configuration has an unsupported setting: " +
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
294 "anonymous_session_lifetime = %r - " % anon_lifetime +
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
295 "please remove it.")
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
296 if anon_lifetime is None:
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
297 anon_lifetime = 0
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
298 anon_lifetime = float(anon_lifetime)
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
299 except:
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
300 # if anything goes wrong, use default value
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
301 anon_lifetime = 0
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
302 try:
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
303 logged_in_lifetime = int(self.cookie_lifetime)
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
304 except:
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
305 # if anything goes wrong, use default value
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
306 logged_in_lifetime = 12
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
307 self.cookie_lifetime = (anon_lifetime, logged_in_lifetime)
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
308 logging.warning("using cookie_lifetime = %r - " % (self.cookie_lifetime, ) +
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
309 "please fix your wiki configuration.")
ad132d9bd526 deal gracefully with cookie_lifetime/anonymous_session_lifetime upgrade issue
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5414
diff changeset
310
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
311 self._loadPluginModule()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
312
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
313 # Preparse user dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
314 self._fillDicts()
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
315
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
316 # Normalize values
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
317 self.language_default = self.language_default.lower()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
318
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
319 # Use site name as default name-logo
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
320 if self.logo_string is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
321 self.logo_string = self.sitename
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
322
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
323 # Check for needed modules
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
324
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
325 # FIXME: maybe we should do this check later, just before a
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
326 # chart is needed, maybe in the chart module, instead doing it
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
327 # for each request. But this require a large refactoring of
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
328 # current code.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
329 if self.chart_options:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
330 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
331 import gdchart
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
332 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
333 self.chart_options = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
334
3761
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
335 # 'setuid' special auth method auth method can log out
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
336 self.auth_can_logout = ['setuid']
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
337 self.auth_login_inputs = []
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
338 found_names = []
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
339 for auth in self.auth:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
340 if not auth.name:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
341 raise error.ConfigurationError("Auth methods must have a name.")
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
342 if auth.name in found_names:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
343 raise error.ConfigurationError("Auth method names must be unique.")
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
344 found_names.append(auth.name)
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
345 if auth.logout_possible and auth.name:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
346 self.auth_can_logout.append(auth.name)
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
347 for input in auth.login_inputs:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
348 if not input in self.auth_login_inputs:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
349 self.auth_login_inputs.append(input)
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
350 self.auth_have_login = len(self.auth_login_inputs) > 0
4530
0ac99fdbe65d fixed suid functionality, compute cfg.auth_methods only once
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4516
diff changeset
351 self.auth_methods = found_names
3761
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
352
2430
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
353 # internal dict for plugin `modules' lists
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
354 self._site_plugin_lists = {}
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
355
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
356 # we replace any string placeholders with config values
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
357 # e.g u'%(page_front_page)s' % self
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
358 self.navi_bar = [elem % self for elem in self.navi_bar]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
359
2989
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
360 # check if python-xapian is installed
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
361 if self.xapian_search:
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
362 try:
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
363 import xapian
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
364 except ImportError, err:
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
365 self.xapian_search = False
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
366 logging.error("xapian_search was auto-disabled because python-xapian is not installed [%s]." % str(err))
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
367
788
4840926790f5 indexed search: added Xapian support (needs more work), removed Lupy support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 528
diff changeset
368 # list to cache xapian searcher objects
4840926790f5 indexed search: added Xapian support (needs more work), removed Lupy support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 528
diff changeset
369 self.xapian_searchers = []
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
370
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
371 # check if mail is possible and set flag:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
372 self.mail_enabled = (self.mail_smarthost is not None or self.mail_sendmail is not None) and self.mail_from
3759
2b78179acbea normalise mail_enabled to a boolean
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3751
diff changeset
373 self.mail_enabled = self.mail_enabled and True or False
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
374
2072
d347a0303be1 Add JID field and a button to send account details with Jabber to user preferences.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2021
diff changeset
375 # check if jabber bot is available and set flag:
2160
7c8ee12f8c1d Fix an error with missing bot_host attribute. Use more descriptive names.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2152
diff changeset
376 self.jabber_enabled = self.notification_bot_uri is not None
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
377
2147
b01a6ef1be4c Get rid of the global xmlrpc Server object. Instantiate one in config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2091
diff changeset
378 # if we are to use the jabber bot, instantiate a server object for future use
b01a6ef1be4c Get rid of the global xmlrpc Server object. Instantiate one in config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2091
diff changeset
379 if self.jabber_enabled:
b01a6ef1be4c Get rid of the global xmlrpc Server object. Instantiate one in config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2091
diff changeset
380 from xmlrpclib import Server
2160
7c8ee12f8c1d Fix an error with missing bot_host attribute. Use more descriptive names.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2152
diff changeset
381 self.notification_server = Server(self.notification_bot_uri, )
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
382
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
383 # Cache variables for the properties below
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
384 self._iwid = self._iwid_full = self._meta_dict = None
1080
f8ba3b0ca9f4 Use the meta dict instead of a distinct file for the IWID.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1053
diff changeset
385
1552
f9639ed07af2 using request.cfg.cache more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1549
diff changeset
386 self.cache.acl_rights_before = AccessControlList(self, [self.acl_rights_before])
f9639ed07af2 using request.cfg.cache more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1549
diff changeset
387 self.cache.acl_rights_default = AccessControlList(self, [self.acl_rights_default])
f9639ed07af2 using request.cfg.cache more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1549
diff changeset
388 self.cache.acl_rights_after = AccessControlList(self, [self.acl_rights_after])
1276
7c29a18a7e26 more memory efficient and faster ACL processing, do not have before/after/default acl in ACL object, but only once in cfg
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1212
diff changeset
389
1339
544b931cd965 new setting url_prefix_action, cleanup page.url/link_to, wikiutil.link_tag
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1318
diff changeset
390 action_prefix = self.url_prefix_action
544b931cd965 new setting url_prefix_action, cleanup page.url/link_to, wikiutil.link_tag
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1318
diff changeset
391 if action_prefix is not None and action_prefix.endswith('/'): # make sure there is no trailing '/'
544b931cd965 new setting url_prefix_action, cleanup page.url/link_to, wikiutil.link_tag
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1318
diff changeset
392 self.url_prefix_action = action_prefix[:-1]
544b931cd965 new setting url_prefix_action, cleanup page.url/link_to, wikiutil.link_tag
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1318
diff changeset
393
1654
2a1f570ea6d4 cfg.url_prefix_local for stuff that needs to be loaded from same-site to work correctly (e.g. FCKeditor - ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1624
diff changeset
394 if self.url_prefix_local is None:
2a1f570ea6d4 cfg.url_prefix_local for stuff that needs to be loaded from same-site to work correctly (e.g. FCKeditor - ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1624
diff changeset
395 self.url_prefix_local = self.url_prefix_static
2a1f570ea6d4 cfg.url_prefix_local for stuff that needs to be loaded from same-site to work correctly (e.g. FCKeditor - ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1624
diff changeset
396
4645
641b595ce675 use url_prefix_fckeditor if you don't want to use the builtin FCKeditor of moin, but a separate one at some specific url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4575
diff changeset
397 if self.url_prefix_fckeditor is None:
641b595ce675 use url_prefix_fckeditor if you don't want to use the builtin FCKeditor of moin, but a separate one at some specific url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4575
diff changeset
398 self.url_prefix_fckeditor = self.url_prefix_local + '/applets/FCKeditor'
641b595ce675 use url_prefix_fckeditor if you don't want to use the builtin FCKeditor of moin, but a separate one at some specific url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4575
diff changeset
399
3881
15bd8dae9003 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873 3880
diff changeset
400 if self.secrets is None: # admin did not setup a real secret, so make up something
15bd8dae9003 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873 3880
diff changeset
401 self.secrets = self.calc_secrets()
15bd8dae9003 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873 3880
diff changeset
402
3873
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
403 secret_key_names = ['action/cache', 'wikiutil/tickets', 'xmlrpc/ProcessMail', 'xmlrpc/RemoteScript', ]
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
404 if self.jabber_enabled:
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
405 secret_key_names.append('jabberbot')
5749
5d5ec86e40a2 improve textcha security (thanks to rfw, GCI 2010)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5647
diff changeset
406 if self.textchas:
5d5ec86e40a2 improve textcha security (thanks to rfw, GCI 2010)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5647
diff changeset
407 secret_key_names.append('security/textcha')
3873
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
408
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
409 secret_min_length = 10
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
410 if isinstance(self.secrets, str):
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
411 if len(self.secrets) < secret_min_length:
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
412 raise error.ConfigurationError("The secrets = '...' wiki config setting is a way too short string (minimum length is %d chars)!" % (
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
413 secret_min_length))
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
414 # for lazy people: set all required secrets to same value
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
415 secrets = {}
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
416 for key in secret_key_names:
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
417 secrets[key] = self.secrets
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
418 self.secrets = secrets
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
419
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
420 # we check if we have all secrets we need and that they have minimum length
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
421 for secret_key_name in secret_key_names:
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
422 try:
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
423 secret = self.secrets[secret_key_name]
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
424 if len(secret) < secret_min_length:
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
425 raise ValueError
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
426 except (KeyError, ValueError):
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
427 raise error.ConfigurationError("You must set a (at least %d chars long) secret string for secrets['%s']!" % (
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3844
diff changeset
428 secret_min_length, secret_key_name))
1654
2a1f570ea6d4 cfg.url_prefix_local for stuff that needs to be loaded from same-site to work correctly (e.g. FCKeditor - ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1624
diff changeset
429
5922
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
430 if self.password_scheme not in config.password_schemes_configurable:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
431 raise error.ConfigurationError("not supported: password_scheme = %r" % self.password_scheme)
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
432
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
433 if self.passlib_support:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
434 try:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
435 from passlib.context import CryptContext
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
436 except ImportError, err:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
437 raise error.ConfigurationError("Wiki is configured to use passlib, but importing passlib failed [%s]!" % str(err))
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
438 try:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
439 self.cache.pwd_context = CryptContext(**self.passlib_crypt_context)
5971
96ef8a8ecc80 improve some passlib related code using the 1.6.1-post-release doc updates
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5924
diff changeset
440 except (ValueError, KeyError, TypeError, UserWarning), err:
5922
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
441 # ValueError: wrong configuration values
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
442 # KeyError: unsupported hash (seen with passlib 1.3)
5971
96ef8a8ecc80 improve some passlib related code using the 1.6.1-post-release doc updates
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5924
diff changeset
443 # TypeError: configuration value has wrong type
5922
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
444 raise error.ConfigurationError("passlib_crypt_context configuration is invalid [%s]." % str(err))
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
445 elif self.password_scheme == '{PASSLIB}':
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
446 raise error.ConfigurationError("passlib_support is switched off, thus you can't use password_scheme = '{PASSLIB}'.")
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
447
3880
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
448 def calc_secrets(self):
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
449 """ make up some 'secret' using some config values """
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
450 varnames = ['data_dir', 'data_underlay_dir', 'language_default',
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
451 'mail_smarthost', 'mail_from', 'page_front_page',
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
452 'theme_default', 'sitename', 'logo_string',
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
453 'interwikiname', 'user_homewiki', 'acl_rights_before', ]
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
454 secret = ''
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
455 for varname in varnames:
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
456 var = getattr(self, varname, None)
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
457 if isinstance(var, (str, unicode)):
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
458 secret += repr(var)
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
459 return secret
85cd05b8af42 refactor ticket secret calculation (only done once, written to cfg.secrets if it is None)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3840
diff changeset
460
3767
0b7f7b9226df config: improve some lazy-loading code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3766
diff changeset
461 _meta_dict = None
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
462 def load_meta_dict(self):
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
463 """ The meta_dict contains meta data about the wiki instance. """
3767
0b7f7b9226df config: improve some lazy-loading code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3766
diff changeset
464 if self._meta_dict is None:
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
465 self._meta_dict = wikiutil.MetaDict(os.path.join(self.data_dir, 'meta'), self.cache_dir)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
466 return self._meta_dict
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
467 meta_dict = property(load_meta_dict)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
468
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
469 # lazily load iwid(_full)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
470 def make_iwid_property(attr):
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
471 def getter(self):
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
472 if getattr(self, attr, None) is None:
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
473 self.load_IWID()
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
474 return getattr(self, attr)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
475 return property(getter)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
476 iwid = make_iwid_property("_iwid")
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
477 iwid_full = make_iwid_property("_iwid_full")
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
478
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
479 # lazily create a list of event handlers
3767
0b7f7b9226df config: improve some lazy-loading code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3766
diff changeset
480 _event_handlers = None
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
481 def make_event_handlers_prop():
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
482 def getter(self):
3767
0b7f7b9226df config: improve some lazy-loading code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3766
diff changeset
483 if self._event_handlers is None:
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
484 self._event_handlers = events.get_handlers(self)
3767
0b7f7b9226df config: improve some lazy-loading code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3766
diff changeset
485 return self._event_handlers
3240
e8fcaf99434f config.multiconfig: PEP8 fixed
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3223
diff changeset
486
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
487 def setter(self, new_handlers):
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
488 self._event_handlers = new_handlers
3240
e8fcaf99434f config.multiconfig: PEP8 fixed
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3223
diff changeset
489
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
490 return property(getter, setter)
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
491 event_handlers = make_event_handlers_prop()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
492
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
493 def load_IWID(self):
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
494 """ Loads the InterWikiID of this instance. It is used to identify the instance
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
495 globally.
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
496 The IWID is available as cfg.iwid
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
497 The full IWID containing the interwiki name is available as cfg.iwid_full
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
498 This method is called by the property.
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
499 """
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
500 try:
1080
f8ba3b0ca9f4 Use the meta dict instead of a distinct file for the IWID.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1053
diff changeset
501 iwid = self.meta_dict['IWID']
f8ba3b0ca9f4 Use the meta dict instead of a distinct file for the IWID.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1053
diff changeset
502 except KeyError:
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
503 iwid = util.random_string(16).encode("hex") + "-" + str(int(time.time()))
1080
f8ba3b0ca9f4 Use the meta dict instead of a distinct file for the IWID.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1053
diff changeset
504 self.meta_dict['IWID'] = iwid
f8ba3b0ca9f4 Use the meta dict instead of a distinct file for the IWID.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1053
diff changeset
505 self.meta_dict.sync()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
506
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
507 self._iwid = iwid
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
508 if self.interwikiname is not None:
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
509 self._iwid_full = packLine([iwid, self.interwikiname])
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
510 else:
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
511 self._iwid_full = packLine([iwid])
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
512
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
513 def _config_check(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
514 """ Check namespace and warn about unknown names
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
515
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
516 Warn about names which are not used by DefaultConfig, except
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
517 modules, classes, _private or __magic__ names.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
518
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
519 This check is disabled by default, when enabled, it will show an
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
520 error message with unknown names.
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
521 """
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
522 unknown = ['"%s"' % name for name in dir(self)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
523 if not name.startswith('_') and
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1799
diff changeset
524 name not in DefaultConfig.__dict__ and
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
525 not isinstance(getattr(self, name), (type(sys), type(DefaultConfig)))]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
526 if unknown:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
527 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
528 Unknown configuration options: %s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
529
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
530 For more information, visit HelpOnConfiguration. Please check your
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
531 configuration for typos before requesting support or reporting a bug.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
532 """ % ', '.join(unknown)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
533 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
534
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
535 def _decode(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
536 """ Try to decode certain names, ignore unicode values
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
537
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
538 Try to decode str using utf-8. If the decode fail, raise FatalError.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
539
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
540 Certain config variables should contain unicode values, and
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
541 should be defined with u'text' syntax. Python decode these if
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
542 the file have a 'coding' line.
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
543
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
544 This will allow utf-8 users to use simple strings using, without
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
545 using u'string'. Other users will have to use u'string' for
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
546 these names, because we don't know what is the charset of the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
547 config files.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
548 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
549 charset = 'utf-8'
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
550 message = u"""
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
551 "%(name)s" configuration variable is a string, but should be
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
552 unicode. Use %(name)s = u"value" syntax for unicode variables.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
553
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
554 Also check your "-*- coding -*-" line at the top of your configuration
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
555 file. It should match the actual charset of the configuration file.
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
556 """
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
557
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
558 decode_names = (
4507
56f98df584e6 made cfg.user_homewiki a unicode object (str only worked for ascii)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4480
diff changeset
559 'sitename', 'interwikiname', 'user_homewiki', 'logo_string', 'navi_bar',
4480
af8cea9bfcda made cfg.interwikiname a unicode object (str only worked for ascii)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4084
diff changeset
560 'page_front_page', 'page_category_regex', 'page_dict_regex',
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
561 'page_group_regex', 'page_template_regex', 'page_license_page',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
562 'page_local_spelling_words', 'acl_rights_default',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
563 'acl_rights_before', 'acl_rights_after', 'mail_from'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
564 )
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
565
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
566 for name in decode_names:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
567 attr = getattr(self, name, None)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
568 if attr:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
569 # Try to decode strings
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
570 if isinstance(attr, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
571 try:
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
572 setattr(self, name, unicode(attr, charset))
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
573 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
574 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
575 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
576 # Look into lists and try to decode strings inside them
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
577 elif isinstance(attr, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
578 for i in xrange(len(attr)):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
579 item = attr[i]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
580 if isinstance(item, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
581 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
582 attr[i] = unicode(item, charset)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
583 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
584 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
585 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
586
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
587 def _check_directories(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
588 """ Make sure directories are accessible
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
589
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
590 Both data and underlay should exists and allow read, write and
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
591 execute.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
592 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
593 mode = os.F_OK | os.R_OK | os.W_OK | os.X_OK
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
594 for attr in ('data_dir', 'data_underlay_dir'):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
595 path = getattr(self, attr)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
596
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
597 # allow an empty underlay path or None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
598 if attr == 'data_underlay_dir' and not path:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
599 continue
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
600
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
601 path_pages = os.path.join(path, "pages")
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
602 if not (os.path.isdir(path_pages) and os.access(path_pages, mode)):
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
603 msg = """
3490
af3460a4cb79 fix some typos in messages / comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3485
diff changeset
604 %(attr)s "%(path)s" does not exist, or has incorrect ownership or
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
605 permissions.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
606
3490
af3460a4cb79 fix some typos in messages / comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3485
diff changeset
607 Make sure the directory and the subdirectory "pages" are owned by the web
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
608 server and are readable, writable and executable by the web server user
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
609 and group.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
610
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
611 It is recommended to use absolute paths and not relative paths. Check
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
612 also the spelling of the directory name.
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
613 """ % {'attr': attr, 'path': path, }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
614 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
615
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
616 def _loadPluginModule(self):
3831
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
617 """
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
618 import all plugin modules
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
619
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
620 To be able to import plugin from arbitrary path, we have to load
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
621 the base package once using imp.load_module. Later, we can use
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
622 standard __import__ call to load plugins in this package.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
623
3831
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
624 Since each configured plugin path has unique plugins, we load the
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
625 plugin packages as "moin_plugin_<sha1(path)>.plugin".
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
626 """
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1787
diff changeset
627 import imp
4363
817d99d715fe remove direct usage of deprecated sha module - use hashlib, if possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4336
diff changeset
628 from MoinMoin.support.python_compatibility import hash_new
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
629
3831
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
630 plugin_dirs = [self.plugin_dir] + self.plugin_dirs
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
631 self._plugin_modules = []
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
632
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
633 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
634 # Lock other threads while we check and import
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
635 imp.acquire_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
636 try:
3831
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
637 for pdir in plugin_dirs:
4363
817d99d715fe remove direct usage of deprecated sha module - use hashlib, if possible
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4336
diff changeset
638 csum = 'p_%s' % hash_new('sha1', pdir).hexdigest()
3831
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
639 modname = '%s.%s' % (self.siteid, csum)
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
640 # If the module is not loaded, try to load it
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
641 if not modname in sys.modules:
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
642 # Find module on disk and try to load - slow!
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
643 abspath = os.path.abspath(pdir)
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
644 parent_dir, pname = os.path.split(abspath)
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
645 fp, path, info = imp.find_module(pname, [parent_dir])
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
646 try:
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
647 # Load the module and set in sys.modules
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
648 module = imp.load_module(modname, fp, path, info)
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
649 setattr(sys.modules[self.siteid], 'csum', module)
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
650 finally:
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
651 # Make sure fp is closed properly
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
652 if fp:
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
653 fp.close()
4031
68951e8e069d plugin module loader: fix _plugin_modules list for the case when module was already loaded before
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3887
diff changeset
654 if modname not in self._plugin_modules:
68951e8e069d plugin module loader: fix _plugin_modules list for the case when module was already loaded before
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3887
diff changeset
655 self._plugin_modules.append(modname)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
656 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
657 imp.release_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
658 except ImportError, err:
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
659 msg = """
3832
682fd34b9422 plugin config: fix error message
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3831
diff changeset
660 Could not import plugin package "%(path)s" because of ImportError:
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
661 %(err)s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
662
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
663 Make sure your data directory path is correct, check permissions, and
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
664 that the data/plugin directory has an __init__.py file.
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
665 """ % {
3832
682fd34b9422 plugin config: fix error message
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3831
diff changeset
666 'path': pdir,
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
667 'err': str(err),
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
668 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
669 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
670
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
671 def _fillDicts(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
672 """ fill config dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
673
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
674 Fills in missing dict keys of derived user config by copying
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
675 them from this base class.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
676 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
677 # user checkbox defaults
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
678 for key, value in DefaultConfig.user_checkbox_defaults.items():
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1799
diff changeset
679 if key not in self.user_checkbox_defaults:
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
680 self.user_checkbox_defaults[key] = value
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
681
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
682 def __getitem__(self, item):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
683 """ Make it possible to access a config object like a dict """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
684 return getattr(self, item)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
685
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
686
3763
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
687 class DefaultConfig(ConfigFunctionality):
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
688 """ Configuration base class with default config values
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
689 (added below)
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
690 """
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
691 # Do not add anything into this class. Functionality must
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
692 # be added above to avoid having the methods show up in
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
693 # the WikiConfig macro. Settings must be added below to
0284379adbc8 some config refactorings, add WikiConfig macro
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3761
diff changeset
694 # the options dictionary.
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
695
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
696
5994
50e82729b826 implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5985
diff changeset
697 _default_backlink_method = lambda cfg, req: 'backlink' if req.user.valid else 'pagelink'
50e82729b826 implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5985
diff changeset
698
50e82729b826 implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5985
diff changeset
699
5924
9894a3344118 default password_checker function now customizable
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5922
diff changeset
700 def _default_password_checker(cfg, request, username, password,
9894a3344118 default password_checker function now customizable
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5922
diff changeset
701 min_length=6, min_different=4):
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
702 """ Check if a password is secure enough.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
703 We use a built-in check to get rid of the worst passwords.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
704
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
705 We do NOT use cracklib / python-crack here any more because it is
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
706 not thread-safe (we experienced segmentation faults when using it).
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
707
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
708 If you don't want to check passwords, use password_checker = None.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
709
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
710 @return: None if there is no problem with the password,
4459
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
711 some unicode object with an error msg, if the password is problematic.
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
712 """
4336
4f3d0b92d1c9 add i18n to the password checker result messages, add request param
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4109
diff changeset
713 _ = request.getText
4459
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
714 # in any case, do a very simple built-in check to avoid the worst passwords
5924
9894a3344118 default password_checker function now customizable
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5922
diff changeset
715 if len(password) < min_length:
4459
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
716 return _("Password is too short.")
5924
9894a3344118 default password_checker function now customizable
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5922
diff changeset
717 if len(set(password)) < min_different:
4459
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
718 return _("Password has not enough different characters.")
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
719
4459
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
720 username_lower = username.lower()
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
721 password_lower = password.lower()
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
722 if username in password or password in username or \
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
723 username_lower in password_lower or password_lower in username_lower:
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
724 return _("Password is too easy (password contains name or name contains password).")
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
725
4459
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
726 keyboards = (ur"`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./", # US kbd
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
727 ur"^1234567890ß´qwertzuiopü+asdfghjklöä#yxcvbnm,.-", # german kbd
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
728 ) # add more keyboards!
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
729 for kbd in keyboards:
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
730 rev_kbd = kbd[::-1]
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
731 if password in kbd or password in rev_kbd or \
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
732 password_lower in kbd or password_lower in rev_kbd:
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
733 return _("Password is too easy (keyboard sequence).")
fc4e32fdd922 remove exception handling from password checker because exceptions can't deal with unicode correctly
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4363
diff changeset
734 return None
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
735
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
736
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
737 class DefaultExpression(object):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
738 def __init__(self, exprstr):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
739 self.text = exprstr
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
740 self.value = eval(exprstr)
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
741
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
742
3817
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
743 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
744 # Options that are not prefixed automatically with their
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
745 # group name, see below (at the options dict) for more
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
746 # information on the layout of this structure.
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
747 #
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
748 options_no_group_name = {
5161
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
749 # =========================================================================
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
750 'attachment_extension': ("Mapping of attachment extensions to actions", None,
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
751 (
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
752 ('extensions_mapping',
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
753 {'.tdraw': {'modify': 'twikidraw'},
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
754 '.adraw': {'modify': 'anywikidraw'},
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
755 }, "file extension -> do -> action"),
d751e9807213 Introduced a new config var "extensions_mapping". You can set up a mapping of attachment extensions to actions. By the drawing syntax these actions are called for the given target.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5146
diff changeset
756 )),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
757 # ==========================================================================
4863
69073f6b028a Groups2009: Dicts and groups values are defined in the config.multiconfig. _tests.wikiconfig_groups was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4737
diff changeset
758 'datastruct': ('Datastruct settings', None, (
4870
eabd8725c940 Groups2009: self changed to cfg in groups and dicts initializing functions.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4863
diff changeset
759 ('dicts', lambda cfg, request: datastruct.WikiDicts(request),
eabd8725c940 Groups2009: self changed to cfg in groups and dicts initializing functions.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4863
diff changeset
760 "function f(cfg, request) that returns a backend which is used to access dicts definitions."),
eabd8725c940 Groups2009: self changed to cfg in groups and dicts initializing functions.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4863
diff changeset
761 ('groups', lambda cfg, request: datastruct.WikiGroups(request),
eabd8725c940 Groups2009: self changed to cfg in groups and dicts initializing functions.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4863
diff changeset
762 "function f(cfg, request) that returns a backend which is used to access groups definitions."),
4863
69073f6b028a Groups2009: Dicts and groups values are defined in the config.multiconfig. _tests.wikiconfig_groups was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4737
diff changeset
763 )),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
764 # ==========================================================================
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
765 'session': ('Session settings', "Session-related settings, see HelpOnSessions.", (
4212
1ca179133f01 Fix tests: small fixes after merge
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4210
diff changeset
766 ('session_service', DefaultExpression('web.session.FileSessionService()'),
4628
3c6980b5e938 fix new session code. remove old session code. details below.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4606
diff changeset
767 "The session service."),
5408
4226fde63931 generate session cookie names to fix some issues (details see below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5382
diff changeset
768 ('cookie_name', None,
5414
b0c8c2f225f3 Changed default of cfg.cookie_name to use some URL components to make up some name.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5408
diff changeset
769 'The variable part of the session cookie name. (None = determine from URL, siteidmagic = use siteid, any other string = use that)'),
4085
afd75bb5f345 merge moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4052 4084
diff changeset
770 ('cookie_secure', None,
afd75bb5f345 merge moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4052 4084
diff changeset
771 'Use secure cookie. (None = auto-enable secure cookie for https, True = ever use secure cookie, False = never use secure cookie).'),
5146
2df8a041ae90 change cookie_httponly default to False, makes trouble with TWikiDraw
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5102
diff changeset
772 ('cookie_httponly', False,
4628
3c6980b5e938 fix new session code. remove old session code. details below.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4606
diff changeset
773 'Use a httponly cookie that can only be used by the server, not by clientside scripts.'),
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
774 ('cookie_domain', None,
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
775 'Domain used in the session cookie. (None = do not specify domain).'),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
776 ('cookie_path', None,
5408
4226fde63931 generate session cookie names to fix some issues (details see below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5382
diff changeset
777 'Path used in the session cookie (None = auto-detect). Please only set if you know exactly what you are doing.'),
4628
3c6980b5e938 fix new session code. remove old session code. details below.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4606
diff changeset
778 ('cookie_lifetime', (0, 12),
3c6980b5e938 fix new session code. remove old session code. details below.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4606
diff changeset
779 'Session lifetime [h] of (anonymous, logged-in) users (see HelpOnSessions for details).'),
3749
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
780 )),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
781 # ==========================================================================
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
782 'auth': ('Authentication / Authorization / Security settings', None, (
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
783 ('superuser', [],
3790
4340777f31f9 remove backup action
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3789
diff changeset
784 "List of trusted user names with wiki system administration super powers (not to be confused with ACL admin rights!). Used for e.g. software installation, language installation via SystemPagesSetup and more. See also HelpOnSuperUser."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
785 ('auth', DefaultExpression('[MoinAuth()]'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
786 "list of auth objects, to be called in this order (see HelpOnAuthentication)"),
4537
f8bf8de778f2 move auth.http.HTTPAuth to auth.GivenAuth, see details below
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4531
diff changeset
787 ('auth_methods_trusted', ['http', 'given', 'xmlrpc_applytoken'], # Note: 'http' auth method is currently just a redirect to 'given'
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
788 'authentication methods for which users should be included in the special "Trusted" ACL group.'),
3881
15bd8dae9003 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873 3880
diff changeset
789 ('secrets', None, """Either a long shared secret string used for multiple purposes or a dict {"purpose": "longsecretstring", ...} for setting up different shared secrets for different purposes. If you don't setup own secret(s), a secret string will be auto-generated from other config settings."""),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
790 ('DesktopEdition',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
791 False,
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
792 "if True, give all local users special powers - ''only use this for a local desktop wiki!''"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
793 ('SecurityPolicy',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
794 None,
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
795 "Class object hook for implementing security restrictions or relaxations"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
796 ('actions_excluded',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
797 ['xmlrpc', # we do not want wiki admins unknowingly offering xmlrpc service
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
798 'MyPages', # only works when used with a non-default SecurityPolicy (e.g. autoadmin)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
799 'CopyPage', # has questionable behaviour regarding subpages a user can't read, but can copy
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
800 ],
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
801 "Exclude unwanted actions (list of strings)"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
802
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
803 ('allow_xslt', False,
5821
99e2309a7ec0 xslt/4suite insecurity hint, always keep allow_xslt = False
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5798
diff changeset
804 "if True, enables XSLT processing via 4Suite (Note that this is DANGEROUS. It enables anyone who can edit the wiki to get '''read/write access to your filesystem as the moin process uid/gid''' and to insert '''arbitrary HTML''' into your wiki pages, which is why this setting defaults to `False` (XSLT disabled). Do not set it to other values, except if you know what you do and if you have very trusted editors only)."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
805
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
806 ('password_checker', DefaultExpression('_default_password_checker'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
807 'checks whether a password is acceptable (default check is length >= 6, at least 4 different chars, no keyboard sequence, not username used somehow (you can switch this off by using `None`)'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
808
5922
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
809 ('password_scheme', '{PASSLIB}',
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
810 'Either "{PASSLIB}" (default) to use passlib for creating and upgrading password hashes (see also passlib_crypt_context for passlib configuration), '
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
811 'or "{SSHA}" (or any other of the builtin password schemes) to not use passlib (not recommended).'),
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
812
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
813 ('passlib_support', True,
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
814 'If True (default), import passlib and support password hashes offered by it.'),
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
815
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
816 ('passlib_crypt_context', dict(
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
817 # schemes we want to support (or deprecated schemes for which we still have
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
818 # hashes in our storage).
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
819 # note: bcrypt: we did not include it as it needs additional code (that is not pure python
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
820 # and thus either needs compiling or installing platform-specific binaries) and
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
821 # also there was some bcrypt issue in passlib < 1.5.3.
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
822 # pbkdf2_sha512: not included as it needs at least passlib 1.4.0
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
823 # sha512_crypt: supported since passlib 1.3.0 (first public release)
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
824 schemes=["sha512_crypt", ],
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
825 # default scheme for creating new pw hashes (if not given, passlib uses first from schemes)
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
826 #default="sha512_crypt",
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
827 # deprecated schemes get auto-upgraded to the default scheme at login
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
828 # time or when setting a password (including doing a moin account pwreset).
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
829 # for passlib >= 1.6, giving ["auto"] means that all schemes except the default are deprecated:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
830 #deprecated=["auto"],
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
831 # to support also older passlib versions, rather give a explicit list:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
832 #deprecated=[],
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
833 # vary rounds parameter randomly when creating new hashes...
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
834 #all__vary_rounds=0.1,
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
835 ),
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
836 "passlib CryptContext arguments, see passlib docs"),
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5891
diff changeset
837
5985
0063e98b14aa cfg.recovery_token_lifetime to determine how long the recovery token will be valid
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5984
diff changeset
838 ('recovery_token_lifetime', 12,
0063e98b14aa cfg.recovery_token_lifetime to determine how long the recovery token will be valid
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5984
diff changeset
839 'how long the password recovery token is valid [h]'),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
840 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
841 # ==========================================================================
4052
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
842 'spam_leech_dos': ('Anti-Spam/Leech/DOS',
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
843 'These settings help limiting ressource usage and avoiding abuse.',
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
844 (
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
845 ('hosts_deny', [], "List of denied IPs; if an IP ends with a dot, it denies a whole subnet (class A, B or C)"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
846 ('surge_action_limits',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
847 {# allow max. <count> <action> requests per <dt> secs
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
848 # action: (count, dt)
3887
f85cd27073a9 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3881 3886
diff changeset
849 'all': (30, 30), # all requests (except cache/AttachFile action) count for this limit
f85cd27073a9 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3881 3886
diff changeset
850 'default': (30, 60), # default limit for actions without a specific limit
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
851 'show': (30, 60),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
852 'recall': (10, 120),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
853 'raw': (20, 40), # some people use this for css
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
854 'diff': (30, 60),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
855 'fullsearch': (10, 120),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
856 'edit': (30, 300), # can be lowered after making preview different from edit
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
857 'rss_rc': (1, 60),
3887
f85cd27073a9 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3881 3886
diff changeset
858 # The following actions are often used for images - to avoid pages with lots of images
f85cd27073a9 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3881 3886
diff changeset
859 # (like photo galleries) triggering surge protection, we assign rather high limits:
5195
012f21c4c04e increase surge protection limits for AttachFile to avoid trouble with image galleries
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5161
diff changeset
860 'AttachFile': (300, 30),
3887
f85cd27073a9 merged some 1.7 changesets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3881 3886
diff changeset
861 'cache': (600, 30), # cache action is very cheap/efficient
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
862 },
5241
495a020af0b5 fix (wiki markup) doc strings used by WikiConfigHelp
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4645
diff changeset
863 "Surge protection tries to deny clients causing too much load/traffic, see HelpOnConfiguration/SurgeProtection."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
864 ('surge_lockout_time', 3600, "time [s] someone gets locked out when ignoring the warnings"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
865
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
866 ('textchas', None,
5633
ea396550d4aa config.multiconfig: exchanged help page to HelpOnSpam.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5600
diff changeset
867 "Spam protection setup using site-specific questions/answers, see HelpOnSpam."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
868 ('textchas_disabled_group', None,
5241
495a020af0b5 fix (wiki markup) doc strings used by WikiConfigHelp
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4645
diff changeset
869 "Name of a group of trusted users who do not get asked !TextCha questions."),
5749
5d5ec86e40a2 improve textcha security (thanks to rfw, GCI 2010)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5647
diff changeset
870 ('textchas_expiry_time', 600,
5d5ec86e40a2 improve textcha security (thanks to rfw, GCI 2010)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5647
diff changeset
871 "Time [s] for a !TextCha to expire."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
872
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
873 ('antispam_master_url', "http://master.moinmo.in/?action=xmlrpc2",
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
874 "where antispam security policy fetches spam pattern updates (if it is enabled)"),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
875
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
876 # a regex of HTTP_USER_AGENTS that should be excluded from logging
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
877 # and receive a FORBIDDEN for anything except viewing a page
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
878 # list must not contain 'java' because of twikidraw wanting to save drawing uses this useragent
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
879 ('ua_spiders',
5798
d0599106e17a remove curl UA from ua_spiders as python-openid uses libcurl (if installed)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5749
diff changeset
880 ('archiver|cfetch|charlotte|crawler|gigabot|googlebot|heritrix|holmes|htdig|httrack|httpunit|'
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
881 'intelix|jeeves|larbin|leech|libwww-perl|linkbot|linkmap|linkwalk|litefinder|mercator|'
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
882 'microsoft.url.control|mirror| mj12bot|msnbot|msrbot|neomo|nutbot|omniexplorer|puf|robot|scooter|seekbot|'
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
883 'sherlock|slurp|sitecheck|snoopy|spider|teleport|twiceler|voilabot|voyager|webreaper|wget|yeti'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
884 "A regex of HTTP_USER_AGENTs that should be excluded from logging and are not allowed to use actions."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
885
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
886 ('unzip_single_file_size', 2.0 * 1000 ** 2,
4052
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
887 "max. size of a single file in the archive which will be extracted [bytes]"),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
888 ('unzip_attachments_space', 200.0 * 1000 ** 2,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
889 "max. total amount of bytes can be used to unzip files [bytes]"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
890 ('unzip_attachments_count', 101,
4052
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
891 "max. number of files which are extracted from the zip file"),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
892 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
893 # ==========================================================================
4052
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
894 'style': ('Style / Theme / UI related',
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
895 'These settings control how the wiki user interface will look like.',
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
896 (
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
897 ('sitename', u'Untitled Wiki',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
898 "Short description of your wiki site, displayed below the logo on each page, and used in RSS documents as the channel title [Unicode]"),
4482
dc854677e9bd interwikiname: document it being unicode
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4481
diff changeset
899 ('interwikiname', None, "unique and stable InterWiki name (prefix, moniker) of the site [Unicode], or None"),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
900 ('logo_string', None, "The wiki logo top of page, HTML is allowed (`<img>` is possible as well) [Unicode]"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
901 ('html_pagetitle', None, "Allows you to set a specific HTML page title (if None, it defaults to the value of `sitename`)"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
902 ('navi_bar', [u'RecentChanges', u'FindPage', u'HelpContents', ],
4483
36f2b2adce52 updated builtin help string for navi_bar to show correct syntax
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4482
diff changeset
903 'Most important page names. Users can add more names in their quick links in user preferences. To link to URL, use `u"[[url|link title]]"`, to use a shortened name for long page name, use `u"[[LongLongPageName|title]]"`. [list of Unicode strings]'),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
904
5221
dd5fc2391c85 use modernized theme by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5195
diff changeset
905 ('theme_default', 'modernized',
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
906 "the name of the theme that is used by default (see HelpOnThemes)"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
907 ('theme_force', False,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
908 "if True, do not allow to change the theme"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
909
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
910 ('stylesheets', [],
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
911 "List of tuples (media, csshref) to insert after theme css, before user css, see HelpOnThemes."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
912
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
913 ('supplementation_page', False,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
914 "if True, show a link to the supplementation page in the theme"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
915 ('supplementation_page_name', u'Discussion',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
916 "default name of the supplementation (sub)page [unicode]"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
917 ('supplementation_page_template', u'DiscussionTemplate',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
918 "default template used for creation of the supplementation page [unicode]"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
919
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
920 ('interwiki_preferred', [], "In dialogues, show those wikis at the top of the list."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
921 ('sistersites', [], "list of tuples `('WikiName', 'sisterpagelist_fetch_url')`"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
922
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
923 ('trail_size', 5,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
924 "Number of pages in the trail of visited pages"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
925
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
926 ('page_footer1', '', "Custom HTML markup sent ''before'' the system footer."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
927 ('page_footer2', '', "Custom HTML markup sent ''after'' the system footer."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
928 ('page_header1', '', "Custom HTML markup sent ''before'' the system header / title area but after the body tag."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
929 ('page_header2', '', "Custom HTML markup sent ''after'' the system header / title area (and body tag)."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
930
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
931 ('changed_time_fmt', '%H:%M', "Time format used on Recent``Changes for page edits within the last 24 hours"),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
932 ('date_fmt', '%Y-%m-%d', "System date format, used mostly in Recent``Changes"),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
933 ('datetime_fmt', '%Y-%m-%d %H:%M:%S', 'Default format for dates and times (when the user has no preferences or chose the "default" date format)'),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
934 ('chart_options', None, "If you have gdchart, use something like chart_options = {'width': 720, 'height': 540}"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
935
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
936 ('edit_bar', ['Edit', 'Comments', 'Discussion', 'Info', 'Subscribe', 'Quicklink', 'Attachments', 'ActionsMenu'],
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
937 'list of edit bar entries'),
5518
b23b1d2b1391 info action: added pagination in history viewer.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5482
diff changeset
938 ('history_count', (100, 200, 5, 10, 25, 50), "Number of revisions shown for info/history action (default_count_shown, max_count_shown, [other values shown as page size choices]). At least first two values (default and maximum) should be provided. If additional values are provided, user will be able to change number of items per page in the UI."),
5597
ced05deb11ae cfg.history_paging: fix grammar/remove performance warning (we don't do that at other places either)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5570
diff changeset
939 ('history_paging', True, "Enable paging functionality for info action's history display."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
940
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
941 ('show_hosts', True,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
942 "if True, show host names and IPs. Set to False to hide them."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
943 ('show_interwiki', False,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
944 "if True, let the theme display your interwiki name"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
945 ('show_names', True,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
946 "if True, show user names in the revision history and on Recent``Changes. Set to False to hide them."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
947 ('show_section_numbers', False,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
948 'show section numbers in headings by default'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
949 ('show_timings', False, "show some timing values at bottom of a page"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
950 ('show_version', False, "show moin's version at the bottom of a page"),
5600
354356b125b4 RenamePage action: added ability to create redirect pages when renaming (turned off by default, see show_rename_redirect config option).
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5597
diff changeset
951 ('show_rename_redirect', False, "if True, offer creation of redirect pages when renaming wiki pages"),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
952
5994
50e82729b826 implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5985
diff changeset
953 ('backlink_method', DefaultExpression('_default_backlink_method'),
50e82729b826 implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5985
diff changeset
954 "function determining how the (last part of the) pagename should be rendered in the title area"),
50e82729b826 implement backlink_method to solve the load issues caused by crawlers triggering too many linkto-fullsearches (see docs/CHANGES for details)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5985
diff changeset
955
5481
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
956 ('packagepages_actions_excluded',
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
957 ['setthemename', # related to questionable theme stuff, see below
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
958 'copythemefile', # maybe does not work, e.g. if no fs write permissions or real theme file path is unknown to moin
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
959 'installplugin', # code installation, potentially dangerous
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
960 'renamepage', # dangerous with hierarchical acls
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
961 'deletepage', # dangerous with hierarchical acls
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
962 'delattachment', # dangerous, no revisioning
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
963 ],
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
964 'list with excluded package actions (e.g. because they are dangerous / questionable)'),
f9a7aa1a4a4a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5241 5479
diff changeset
965
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
966 ('page_credits',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
967 [
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
968 '<a href="http://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin Powered</a>',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
969 '<a href="http://moinmo.in/Python" title="MoinMoin is written in Python.">Python Powered</a>',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
970 '<a href="http://moinmo.in/GPL" title="MoinMoin is GPL licensed.">GPL licensed</a>',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
971 '<a href="http://validator.w3.org/check?uri=referer" title="Click here to validate this page.">Valid HTML 4.01</a>',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
972 ],
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
973 'list with html fragments with logos or strings for crediting.'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
974
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
975 # These icons will show in this order in the iconbar, unless they
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
976 # are not relevant, e.g email icon when the wiki is not configured
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
977 # for email.
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
978 ('page_iconbar', ["up", "edit", "view", "diff", "info", "subscribe", "raw", "print", ],
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
979 'list of icons to show in iconbar, valid values are only those in page_icons_table. Available only in classic theme.'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
980
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
981 # Standard buttons in the iconbar
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
982 ('page_icons_table',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
983 {
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
984 # key pagekey, querystr dict, title, icon-key
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
985 'diff': ('page', {'action': 'diff'}, _("Diffs"), "diff"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
986 'info': ('page', {'action': 'info'}, _("Info"), "info"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
987 'edit': ('page', {'action': 'edit'}, _("Edit"), "edit"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
988 'unsubscribe': ('page', {'action': 'unsubscribe'}, _("UnSubscribe"), "unsubscribe"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
989 'subscribe': ('page', {'action': 'subscribe'}, _("Subscribe"), "subscribe"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
990 'raw': ('page', {'action': 'raw'}, _("Raw"), "raw"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
991 'xml': ('page', {'action': 'show', 'mimetype': 'text/xml'}, _("XML"), "xml"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
992 'print': ('page', {'action': 'print'}, _("Print"), "print"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
993 'view': ('page', {}, _("View"), "view"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
994 'up': ('page_parent_page', {}, _("Up"), "up"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
995 },
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
996 "dict of {'iconname': (url, title, icon-img-key), ...}. Available only in classic theme."),
5858
be11f1e64e73 Page.py: added message with information about highlight regexp and link to non-highlighted version (disabled by default in config).
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5856
diff changeset
997 ('show_highlight_msg', False, "Show message that page has highlighted text "
be11f1e64e73 Page.py: added message with information about highlight regexp and link to non-highlighted version (disabled by default in config).
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5856
diff changeset
998 "and provide link to non-highlighted "
be11f1e64e73 Page.py: added message with information about highlight regexp and link to non-highlighted version (disabled by default in config).
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5856
diff changeset
999 "version."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1000 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1001 # ==========================================================================
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1002 'editor': ('Editor related', None, (
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1003 ('editor_default', 'text', "Editor to use by default, 'text' or 'gui'"),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1004 ('editor_force', False, "if True, force using the default editor"),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1005 ('editor_ui', 'freechoice', "Editor choice shown on the user interface, 'freechoice' or 'theonepreferred'"),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1006 ('page_license_enabled', False, 'if True, show a license hint in page editor.'),
3789
9173925a53da config: move page_license_page
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3784
diff changeset
1007 ('page_license_page', u'WikiLicense', 'Page linked from the license hint. [Unicode]'),
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1008 ('edit_locking', 'warn 10', "Editor locking policy: `None`, `'warn <timeout in minutes>'`, or `'lock <timeout in minutes>'`"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1009 ('edit_ticketing', True, None),
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1010 ('edit_rows', 20, "Default height of the edit box"),
5891
16f3285443ca rename require_comment option to comment_required
Matthijs Kooijman <matthijs@stdin.nl>
parents: 5889
diff changeset
1011 ('comment_required', False, "if True, only allow saving if a comment is filled in"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1012
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1013 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1014 # ==========================================================================
3783
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
1015 'paths': ('Paths', None, (
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1016 ('data_dir', './data/', "Path to the data directory containing your (locally made) wiki pages."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1017 ('data_underlay_dir', './underlay/', "Path to the underlay directory containing distribution system and help pages."),
3783
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
1018 ('cache_dir', None, "Directory for caching, by default computed from `data_dir`/cache."),
4531
83666cc9dc31 new cfg.session_dir setting, store sessions into cache_dir/__session__ by default
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4530
diff changeset
1019 ('session_dir', None, "Directory for session storage, by default computed to be `cache_dir`/__session__."),
3783
d9431d180aff config improvements wrt. computed settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3782
diff changeset
1020 ('user_dir', None, "Directory for user storage, by default computed to be `data_dir`/user."),
3831
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
1021 ('plugin_dir', None, "Plugin directory, by default computed to be `data_dir`/plugin."),
4a3c996f2d5f plugins: allow multiple plugin paths
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3823
diff changeset
1022 ('plugin_dirs', [], "Additional plugin directories."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1023
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1024 ('docbook_html_dir', r"/usr/share/xml/docbook/stylesheet/nwalsh/html/",
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1025 'Path to the directory with the Docbook to HTML XSLT files (optional, used by the docbook parser). The default value is correct for Debian Etch.'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1026 ('shared_intermap', None,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1027 "Path to a file containing global InterWiki definitions (or a list of such filenames)"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1028 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1029 # ==========================================================================
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1030 'urls': ('URLs', None, (
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1031 # includes the moin version number, so we can have a unlimited cache lifetime
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1032 # for the static stuff. if stuff changes on version upgrade, url will change
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1033 # immediately and we have no problem with stale caches.
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1034 ('url_prefix_static', config.url_prefix_static,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1035 "used as the base URL for icons, css, etc. - includes the moin version number and changes on every release. This replaces the deprecated and sometimes confusing `url_prefix = '/wiki'` setting."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1036 ('url_prefix_local', None,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1037 "used as the base URL for some Javascript - set this to a URL on same server as the wiki if your url_prefix_static points to a different server."),
4645
641b595ce675 use url_prefix_fckeditor if you don't want to use the builtin FCKeditor of moin, but a separate one at some specific url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4575
diff changeset
1038 ('url_prefix_fckeditor', None,
641b595ce675 use url_prefix_fckeditor if you don't want to use the builtin FCKeditor of moin, but a separate one at some specific url
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4575
diff changeset
1039 "used as the base URL for FCKeditor - similar to url_prefix_local, but just for FCKeditor."),
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1040
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1041 ('url_prefix_action', None,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1042 "Use 'action' to enable action URL generation to be compatible with robots.txt. It will generate .../action/info/PageName?action=info then. Recommended for internet wikis."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1043
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1044 ('notification_bot_uri', None, "URI of the Jabber notification bot."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1045
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1046 ('url_mappings', {},
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1047 "lookup table to remap URL prefixes (dict of {{{'prefix': 'replacement'}}}); especially useful in intranets, when whole trees of externally hosted documents move around"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1048
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1049 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1050 # ==========================================================================
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1051 'pages': ('Special page names', None, (
4737
ebe54f59e87c system/help page packages: build all pagesets, use LanguageSetup as front page (unifies old SystemPagesSetup with the setup specific part of HelpOnLanguages)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4649
diff changeset
1052 ('page_front_page', u'LanguageSetup',
ebe54f59e87c system/help page packages: build all pagesets, use LanguageSetup as front page (unifies old SystemPagesSetup with the setup specific part of HelpOnLanguages)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4649
diff changeset
1053 "Name of the front page. We don't expect you to keep the default. Just read LanguageSetup in case you're wondering... [Unicode]"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1054
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1055 # the following regexes should match the complete name when used in free text
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1056 # the group 'all' shall match all, while the group 'key' shall match the key only
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1057 # e.g. CategoryFoo -> group 'all' == CategoryFoo, group 'key' == Foo
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1058 # moin's code will add ^ / $ at beginning / end when needed
3823
262738c1f46b prevent CategoryTemplate being listed as a category (it is a Template, but matched also the category regex)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3817
diff changeset
1059 ('page_category_regex', ur'(?P<all>Category(?P<key>(?!Template)\S+))',
3782
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1060 'Pagenames exactly matching this regex are regarded as Wiki categories [Unicode]'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1061 ('page_dict_regex', ur'(?P<all>(?P<key>\S+)Dict)',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1062 'Pagenames exactly matching this regex are regarded as pages containing variable dictionary definitions [Unicode]'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1063 ('page_group_regex', ur'(?P<all>(?P<key>\S+)Group)',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1064 'Pagenames exactly matching this regex are regarded as pages containing group definitions [Unicode]'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1065 ('page_template_regex', ur'(?P<all>(?P<key>\S+)Template)',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1066 'Pagenames exactly matching this regex are regarded as pages containing templates for new pages [Unicode]'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1067
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1068 ('page_local_spelling_words', u'LocalSpellingWords',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1069 'Name of the page containing user-provided spellchecker words [Unicode]'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1070 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1071 # ==========================================================================
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1072 'user': ('User Preferences related', None, (
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1073 ('quicklinks_default', [],
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1074 'List of preset quicklinks for a newly created user accounts. Existing accounts are not affected by this option whereas changes in navi_bar do always affect existing accounts. Preset quicklinks can be removed by the user in the user preferences menu, navi_bar settings not.'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1075 ('subscribed_pages_default', [],
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1076 "List of pagenames used for presetting page subscriptions for newly created user accounts."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1077
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1078 ('email_subscribed_events_default',
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1079 [
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1080 PageChangedEvent.__name__,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1081 PageRenamedEvent.__name__,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1082 PageDeletedEvent.__name__,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1083 PageCopiedEvent.__name__,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1084 PageRevertedEvent.__name__,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1085 FileAttachedEvent.__name__,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1086 ], None),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1087 ('jabber_subscribed_events_default', [], None),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1088
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1089 ('tz_offset', 0.0,
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1090 "default time zone offset in hours from UTC"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1091
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1092 ('userprefs_disabled', [],
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1093 "Disable the listed user preferences plugins."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1094 )),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1095 # ==========================================================================
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1096 'various': ('Various', None, (
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1097 ('bang_meta', True, 'if True, enable {{{!NoWikiName}}} markup'),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1098 ('caching_formats', ['text_html'], "output formats that are cached; set to [] to turn off caching (useful for development)"),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1099
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1100 ('config_check_enabled', False, "if True, check configuration for unknown settings."),
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1101
791011b5c3fd multiconfig: better grouping of settings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3781
diff changeset
1102 ('default_markup', 'wiki', 'Default page parser / format (name of module in `MoinMoin.parser`)'),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1103
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1104 ('html_head', '', "Additional <HEAD> tags, see HelpOnThemes."),
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1105 ('html_head_queries', '<meta name="robots" content="noindex,nofollow">\n',
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1106 "Additional <HEAD> tags for requests with query strings, like actions."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1107 ('html_head_posts', '<meta name="robots" content="noindex,nofollow">\n',
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1108 "Additional <HEAD> tags for POST requests."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1109 ('html_head_index', '<meta name="robots" content="index,follow">\n',
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1110 "Additional <HEAD> tags for some few index pages."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1111 ('html_head_normal', '<meta name="robots" content="index,nofollow">\n',
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1112 "Additional <HEAD> tags for most normal pages."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1113
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1114 ('language_default', 'en', "Default language for user interface and page content, see HelpOnLanguages."),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1115 ('language_ignore_browser', False, "if True, ignore user's browser language settings, see HelpOnLanguages."),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1116
4470
ea2aa935fbde cfg.log_remote_addr (default: True) controls whether moin logs remote's IP/hostname to edit-log and event-log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4459
diff changeset
1117 ('log_remote_addr', True,
ea2aa935fbde cfg.log_remote_addr (default: True) controls whether moin logs remote's IP/hostname to edit-log and event-log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4459
diff changeset
1118 "if True, log the remote IP address (and maybe hostname)."),
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1119 ('log_reverse_dns_lookups', True,
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1120 "if True, do a reverse DNS lookup on page SAVE. If your DNS is broken, set this to False to speed up SAVE."),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1121 ('log_timing', False,
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1122 "if True, add timing infos to the log output to analyse load conditions"),
5977
f662e5f7ca82 cfg.log_events_format to configure event-log format, add a tool to export event-log to CSV
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5972
diff changeset
1123 ('log_events_format', 1,
f662e5f7ca82 cfg.log_events_format to configure event-log format, add a tool to export event-log to CSV
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5972
diff changeset
1124 "0 = no events logging, 1 = standard format (like <= 1.9.7) [default], 2 = extended format"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1125
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1126 # some dangerous mimetypes (we don't use "content-disposition: inline" for them when a user
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1127 # downloads such attachments, because the browser might execute e.g. Javascript contained
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1128 # in the HTML and steal your moin session cookie or do other nasty stuff)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1129 ('mimetypes_xss_protect',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1130 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1131 'text/html',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1132 'application/x-shockwave-flash',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1133 'application/xhtml+xml',
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1134 ],
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1135 '"content-disposition: inline" isn\'t used for them when a user downloads such attachments'),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1136
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1137 ('mimetypes_embed',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1138 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1139 'application/x-dvi',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1140 'application/postscript',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1141 'application/pdf',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1142 'application/ogg',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1143 'application/vnd.visio',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1144 'image/x-ms-bmp',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1145 'image/svg+xml',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1146 'image/tiff',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1147 'image/x-photoshop',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1148 'audio/mpeg',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1149 'audio/midi',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1150 'audio/x-wav',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1151 'video/fli',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1152 'video/mpeg',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1153 'video/quicktime',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1154 'video/x-msvideo',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1155 'chemical/x-pdb',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1156 'x-world/x-vrml',
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1157 ],
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1158 'mimetypes that can be embedded by the [[HelpOnMacros/EmbedObject|EmbedObject macro]]'),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1159
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1160 ('refresh', None,
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1161 "refresh = (minimum_delay_s, targets_allowed) enables use of `#refresh 5 PageName` processing instruction, targets_allowed must be either `'internal'` or `'external'`"),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1162 ('rss_cache', 60, "suggested caching time for Recent''''''Changes RSS, in second"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1163
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1164 ('search_results_per_page', 25, "Number of hits shown per page in the search results"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1165
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1166 ('siteid', 'default', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1167 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1168 }
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1169
3817
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1170 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1171 # The 'options' dict carries default MoinMoin options. The dict is a
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1172 # group name to tuple mapping.
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1173 # Each group tuple consists of the following items:
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1174 # group section heading, group help text, option list
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1175 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1176 # where each 'option list' is a tuple or list of option tuples
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1177 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1178 # each option tuple consists of
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1179 # option name, default value, help text
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1180 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1181 # All the help texts will be displayed by the WikiConfigHelp() macro.
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1182 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1183 # Unlike the options_no_group_name dict, option names in this dict
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1184 # are automatically prefixed with "group name '_'" (i.e. the name of
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1185 # the group they are in and an underscore), e.g. the 'hierarchic'
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1186 # below creates an option called "acl_hierarchic".
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1187 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1188 # If you need to add a complex default expression that results in an
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1189 # object and should not be shown in the __repr__ form in WikiConfigHelp(),
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1190 # you can use the DefaultExpression class, see 'auth' above for example.
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1191 #
98660492e634 document new multiconfig option structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3790
diff changeset
1192 #
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1193 options = {
4052
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
1194 'acl': ('Access control lists',
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
1195 'ACLs control who may do what, see HelpOnAccessControlLists.',
0cdc180a2932 improve config setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4051
diff changeset
1196 (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1197 ('hierarchic', False, 'True to use hierarchical ACLs'),
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1198 ('rights_default', u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write",
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1199 "ACL used if no ACL is specified on the page"),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1200 ('rights_before', u"",
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1201 "ACL that is processed before the on-page/default ACL"),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1202 ('rights_after', u"",
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1203 "ACL that is processed after the on-page/default ACL"),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1204 ('rights_valid', ['read', 'write', 'delete', 'revert', 'admin'],
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1205 "Valid tokens for right sides of ACL entries."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1206 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1207
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1208 'xapian': ('Xapian search', "Configuration of the Xapian based indexed search, see HelpOnXapian.", (
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1209 ('search', False,
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1210 "True to enable the fast, indexed search (based on the Xapian search library)"),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1211 ('index_dir', None,
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1212 "Directory where the Xapian search index is stored (None = auto-configure wiki local storage)"),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1213 ('stemming', False,
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1214 "True to enable Xapian word stemmer usage for indexing / searching."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1215 ('index_history', False,
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1216 "True to enable indexing of non-current page revisions."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1217 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1218
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1219 'user': ('Users / User settings', None, (
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1220 ('email_unique', True,
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1221 "if True, check email addresses for uniqueness and don't accept duplicates."),
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1222 ('jid_unique', True,
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1223 "if True, check Jabber IDs for uniqueness and don't accept duplicates."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1224
4509
ac61d43c1c5a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4483 4507
diff changeset
1225 ('homewiki', u'Self',
ac61d43c1c5a merged moin/1.7
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4483 4507
diff changeset
1226 "interwiki name of the wiki where the user home pages are located [Unicode] - useful if you have ''many'' users. You could even link to nonwiki \"user pages\" if the wiki username is in the target URL."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1227
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1228 ('checkbox_fields',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1229 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1230 ('mailto_author', lambda _: _('Publish my email (not my wiki homepage) in author info')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1231 ('edit_on_doubleclick', lambda _: _('Open editor on double click')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1232 ('remember_last_visit', lambda _: _('After login, jump to last visited page')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1233 ('show_comments', lambda _: _('Show comment sections')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1234 ('show_nonexist_qm', lambda _: _('Show question mark for non-existing pagelinks')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1235 ('show_page_trail', lambda _: _('Show page trail')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1236 ('show_toolbar', lambda _: _('Show icon toolbar')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1237 ('show_topbottom', lambda _: _('Show top/bottom links in headings')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1238 ('show_fancy_diff', lambda _: _('Show fancy diffs')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1239 ('wikiname_add_spaces', lambda _: _('Add spaces to displayed wiki names')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1240 ('remember_me', lambda _: _('Remember login information')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1241
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1242 ('disabled', lambda _: _('Disable this account forever')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1243 # if an account is disabled, it may be used for looking up
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1244 # id -> username for page info and recent changes, but it
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1245 # is not usable for the user any more:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1246 ],
5241
495a020af0b5 fix (wiki markup) doc strings used by WikiConfigHelp
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4645
diff changeset
1247 "Describes user preferences, see HelpOnConfiguration/UserPreferences."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1248
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1249 ('checkbox_defaults',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1250 {
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1251 'mailto_author': 0,
5647
7248a38409bd enable double-click-editing by default for easier testing
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5633
diff changeset
1252 'edit_on_doubleclick': 1,
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1253 'remember_last_visit': 0,
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1254 'show_comments': 0,
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1255 'show_nonexist_qm': False,
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1256 'show_page_trail': 1,
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1257 'show_toolbar': 1,
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1258 'show_topbottom': 0,
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1259 'show_fancy_diff': 1,
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1260 'wikiname_add_spaces': 0,
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1261 'remember_me': 1,
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1262 },
5241
495a020af0b5 fix (wiki markup) doc strings used by WikiConfigHelp
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4645
diff changeset
1263 "Defaults for user preferences, see HelpOnConfiguration/UserPreferences."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1264
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1265 ('checkbox_disable', [],
5241
495a020af0b5 fix (wiki markup) doc strings used by WikiConfigHelp
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4645
diff changeset
1266 "Disable user preferences, see HelpOnConfiguration/UserPreferences."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1267
3766
6a618481be28 add help texts to configuration items
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3763
diff changeset
1268 ('checkbox_remove', [],
5241
495a020af0b5 fix (wiki markup) doc strings used by WikiConfigHelp
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4645
diff changeset
1269 "Remove user preferences, see HelpOnConfiguration/UserPreferences."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1270
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1271 ('form_fields',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1272 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1273 ('name', _('Name'), "text", "36", _("(Use FirstnameLastname)")),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1274 ('aliasname', _('Alias-Name'), "text", "36", ''),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1275 ('email', _('Email'), "text", "36", ''),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1276 ('jid', _('Jabber ID'), "text", "36", ''),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1277 ('css_url', _('User CSS URL'), "text", "40", _('(Leave it empty for disabling user CSS)')),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1278 ('edit_rows', _('Editor size'), "text", "3", ''),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1279 ],
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1280 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1281
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1282 ('form_defaults',
3779
9aad6c344482 multiconfig: PEP8 fixes, typos, no code change
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3771
diff changeset
1283 {# key: default - do NOT remove keys from here!
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1284 'name': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1285 'aliasname': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1286 'password': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1287 'password2': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1288 'email': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1289 'jid': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1290 'css_url': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1291 'edit_rows': "20",
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1292 },
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1293 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1294
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1295 ('form_disable', [], "list of field names used to disable user preferences form fields"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1296
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1297 ('form_remove', [], "list of field names used to remove user preferences form fields"),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1298
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1299 ('transient_fields',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1300 ['id', 'valid', 'may', 'auth_username', 'password', 'password2', 'auth_method', 'auth_attribs', ],
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1301 "User object attributes that are not persisted to permanent storage (internal use)."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1302 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1303
5382
942766fe487d openid client: add setting cfg.openidrp_allowed_op, default is []
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5242
diff changeset
1304 'openidrp': ('OpenID Relying Party',
942766fe487d openid client: add setting cfg.openidrp_allowed_op, default is []
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5242
diff changeset
1305 'These settings control the built-in OpenID Relying Party (client).',
942766fe487d openid client: add setting cfg.openidrp_allowed_op, default is []
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5242
diff changeset
1306 (
942766fe487d openid client: add setting cfg.openidrp_allowed_op, default is []
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5242
diff changeset
1307 ('allowed_op', [], "List of forced providers"),
942766fe487d openid client: add setting cfg.openidrp_allowed_op, default is []
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5242
diff changeset
1308 )),
942766fe487d openid client: add setting cfg.openidrp_allowed_op, default is []
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 5242
diff changeset
1309
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1310 'openid_server': ('OpenID Server',
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1311 'These settings control the built-in OpenID Identity Provider (server).',
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1312 (
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1313 ('enabled', False, "True to enable the built-in OpenID server."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1314 ('restricted_users_group', None, "If set to a group name, the group members are allowed to use the wiki as an OpenID provider. (None = allow for all users)"),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1315 ('enable_user', False, "If True, the OpenIDUser processing instruction is allowed."),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1316 )),
3746
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1317
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1318 'mail': ('Mail settings',
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1319 'These settings control outgoing and incoming email from and to the wiki.',
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1320 (
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1321 ('from', None, "Used as From: address for generated mail."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1322 ('login', None, "'username userpass' for SMTP server authentication (None = don't use auth)."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1323 ('smarthost', None, "Address of SMTP server to use for sending mail (None = don't use SMTP server)."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1324 ('sendmail', None, "sendmail command to use for sending mail (None = don't use sendmail)"),
3746
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1325
3781
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1326 ('import_subpage_template', u"$from-$date-$subject", "Create subpages using this template when importing mail."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1327 ('import_pagename_search', ['subject', 'to', ], "Where to look for target pagename specification."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1328 ('import_pagename_envelope', u"%s", "Use this to add some fixed prefix/postfix to the generated target pagename."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1329 ('import_pagename_regex', r'\[\[([^\]]*)\]\]', "Regular expression used to search for target pagename specification."),
a637edbeb5fa multiconfig: added more setting descriptions
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3779
diff changeset
1330 ('import_wiki_addrs', [], "Target mail addresses to consider when importing mail"),
3746
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1331 )),
4051
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1332
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1333 'backup': ('Backup settings',
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1334 'These settings control how the backup action works and who is allowed to use it.',
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1335 (
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1336 ('compression', 'gz', 'What compression to use for the backup ("gz" or "bz2").'),
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1337 ('users', [], 'List of trusted user names who are allowed to get a backup.'),
4108
1cd493d5e113 fix backup action configuration (broke on windows due to backslashes in e.g. cache_dir)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4085
diff changeset
1338 ('include', [], 'List of pathes to backup.'),
4575
bc0ad5554ab0 backup action: add 'self' dummy argument for backup_exclude function
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4509
diff changeset
1339 ('exclude', lambda self, filename: False, 'Function f(self, filename) that tells whether a file should be excluded from backup. By default, nothing is excluded.'),
4051
63fbadea490e partially reverted removal of backup action (without the problematic 'restore' code) - we'll keep this until the refactored storage code is merged
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4041
diff changeset
1340 )),
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1341 'rss': ('RSS settings',
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1342 'These settings control RSS behaviour.',
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1343 (
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1344 ('items_default', 15, "Default maximum items value for RSS feed. Can be "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1345 "changed via items URL query parameter of rss_rc "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1346 "action."),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1347 ('items_limit', 100, "Limit for item count got via RSS (i. e. user "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1348 "can't get more than items_limit items even via "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1349 "changing items URL query parameter)."),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1350 ('unique', 0, "If set to 1, for each page name only one RSS item would "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1351 "be shown. Can be changed via unique rss_rc action URL "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1352 "query parameter."),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1353 ('diffs', 0, "Add diffs in RSS item descriptions by default. Can be "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1354 "changed via diffs URL query parameter of rss_rc action."),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1355 ('ddiffs', 0, "If set to 1, links to diff view instead of page itself "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1356 "would be generated by default. Can be changed via ddiffs "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1357 "URL query parameter of rss_rc action."),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1358 ('lines_default', 20, "Default line count limit for diffs added as item "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1359 "descriptions for RSS items. Can be changed via "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1360 "lines URL query parameter of rss_rc action."),
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1361 ('lines_limit', 100, "Limit for possible line count for diffs added as "
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1362 "item descriptions in RSS."),
5844
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
1363 ('show_attachment_entries', 0, "If set to 1, items, related to "
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
1364 "attachment management, would be added to "
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
1365 "RSS feed. Can be changed via show_att "
3d997b1235fe action/rss_rc.py: added ability to show attachment-related actions in RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5841
diff changeset
1366 "URL query parameter of rss_rc action."),
5845
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1367 ('page_filter_pattern', "", "Default page filter pattern for RSS feed. "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1368 "Empty pattern matches to any page. Pattern "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1369 "beginning with circumflex is interpreted as "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1370 "regular expression. Pattern ending with "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1371 "slash matches page and all its subpages. "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1372 "Otherwise pattern sets specific pagename. "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1373 "Can be changed via page URL query parameter "
0e1b4214318f action/rss_rc.py: added ability to set pagename-based filtering for RSS.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5844
diff changeset
1374 "of rss_rc action."),
5850
8b4f02226670 Option which gives ability to turn off addition of page history RSS feed link added.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5845
diff changeset
1375 ('show_page_history_link', True, "Add link to page change history "
8b4f02226670 Option which gives ability to turn off addition of page history RSS feed link added.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5845
diff changeset
1376 "RSS feed in theme."),
5841
8b3c4b85921b action/rss_rc.py: param parsing rewritten to support retrieval of default values from wiki configuration.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5821
diff changeset
1377 )),
5856
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1378 'search_macro': ('Search macro settings',
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1379 'Settings related to behaviour of search macros (such as FullSearch, '
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1380 'FullSearchCached, PageList)',
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1381 (
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1382 ('parse_args', False, "Do search macro parameter parsing. In previous "
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1383 "versions of MoinMoin, whole search macro "
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1384 "parameter string had been interpreted as needle. "
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1385 "Now, to provide ability to pass additional "
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1386 "parameters, this behaviour should be changed."),
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1387 ('highlight_titles', 1, "Perform title matches highlighting by default "
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1388 "in search results generated by macro."),
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1389 ('highlight_pages', 1, "Add highlight parameter to links in search "
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1390 "results generated by search macros by default."),
8e5559a0a08b PageList, FullSearch macros: ability to suppress highlighting in result list and item links added alongside with appropriate configuration options. PageList macros is now implemented via FullSearch macros for code deduplication.
Eugene Syromyatnikov <evgsyr@gmail.com>
parents: 5850
diff changeset
1391 )),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1392 }
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1393
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1394 def _add_options_to_defconfig(opts, addgroup=True):
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1395 for groupname in opts:
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1396 group_short, group_doc, group_opts = opts[groupname]
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1397 for name, default, doc in group_opts:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1398 if addgroup:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1399 name = groupname + '_' + name
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
1400 if isinstance(default, DefaultExpression):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
1401 default = default.value
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1402 setattr(DefaultConfig, name, default)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1403
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1404 _add_options_to_defconfig(options)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1405 _add_options_to_defconfig(options_no_group_name, False)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1406
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
1407 # remove the gettext pseudo function
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1408 del _
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1409