annotate MoinMoin/config/multiconfig.py @ 3761:24e9fecdd81c

config: move auth post-processing to proper place
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sun, 22 Jun 2008 02:26:33 +0200
parents f004cd750c86
children 0284379adbc8
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.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
7 @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
8 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
9
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
10 import re
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
11 import os
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
12 import sys
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
13 import time
3107
c6e39279f83b refactor logging usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3097
diff changeset
14
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
15 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
16 logging = log.getLogger(__name__)
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
17
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
18 from MoinMoin import config, error, util, wikiutil
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
19 from MoinMoin.auth import MoinAuth
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
20 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
21 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
22 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
23 from MoinMoin.events import PageRevertedEvent, FileAttachedEvent
2009
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
24 from MoinMoin import 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
25 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
26 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
27 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
28
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
29 _url_re_cache = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
30 _farmconfig_mtime = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
31 _config_cache = {}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
32
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
33
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
34 def _importConfigModule(name):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
35 """ 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
36
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
37 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
38 always an error.
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 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
41 @rtype: tuple
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
42 @return: module, modification time
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
43 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
44 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
45 module = __import__(name, globals(), {})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
46 mtime = os.path.getmtime(module.__file__)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
47 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
48 raise
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
49 except IndentationError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
50 logging.exception('Your source code / config file is not correctly indented!')
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
51 msg = '''IndentationError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
52
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
53 The configuration files are python modules. Therefore, whitespace is
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
54 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
55 You have to use four spaces at the beginning of the line mostly.
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
56 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
57 '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
58 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
59 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
60 except Exception, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
61 logging.exception('An exception happened.')
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
62 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
63 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
64 return module, mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
65
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
66
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
67 def _url_re_list():
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
68 """ Return url matching regular expression
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 Import wikis list from farmconfig on the first call and compile the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
71 regexes. Later then return the cached regex list.
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 @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
74 @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
75 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
76 global _url_re_cache, _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
77 if _url_re_cache is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
78 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
79 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
80 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
81 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
82 # 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
83 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
84 _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
85 _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
86 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
87 # 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
88 raise
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
89 else:
3129
d57fed1b0b43 multiconfig: also log which farmconfig we use
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3126
diff changeset
90 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
91 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
92 cache = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
93 for name, regex in farmconfig.wikis:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
94 cache.append((name, re.compile(regex)))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
95 _url_re_cache = cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
96 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
97 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
98 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
99 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
100
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
101 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
102 use wikiconfig.py.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
103 """
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
104 raise error.ConfigurationError(msg)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
105 return _url_re_cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
106
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
107
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
108 def _makeConfig(name):
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
109 """ 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
110
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
111 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
112 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
113
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
114 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
115 @rtype: DefaultConfig sub class instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
116 @return: new configuration instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
117 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
118 global _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
119 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
120 module, mtime = _importConfigModule(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
121 configClass = getattr(module, 'Config')
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
122 cfg = configClass(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
123 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
124 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
125 except ImportError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
126 logging.exception('Could not import.')
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
127 msg = '''ImportError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
128
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
129 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
130 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
131 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
132 the top of the server script.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
133
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
134 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
135 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
136 module name does not include the ".py" suffix.
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
137 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
138 '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
139 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
140 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
141 except AttributeError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
142 logging.exception('An exception occured.')
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
143 msg = '''AttributeError: %(err)s
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
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
145 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
146
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 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
148 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
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 Another reason for this could be a name clash. It is not possible to have
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 config names like e.g. stats.py - because that colides with MoinMoin/stats/ -
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 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
153 possible.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
154
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
155 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
156 use the wikiconfig.py file from the distribution.
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
157 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
158 '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
159 '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
160 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
161 raise error.ConfigurationError(msg)
2009
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
162
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
163 return cfg
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
164
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
165
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
166 def _getConfigName(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
167 """ 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
168 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
169 match = regex.match(url)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
170 if match:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
171 return name
1575
45f876b6a109 raise NoConfigMatchedError
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1573
diff changeset
172 raise error.NoConfigMatchedError
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
173
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
174
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
175 def getConfig(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
176 """ 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
177
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
178 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
179 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
180 returned, using dict.setdefault.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
181
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
182 @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
183 @rtype: DefaultConfig subclass instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
184 @return: config object for specific wiki
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
185 """
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
186 cfgName = _getConfigName(url)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
187 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
188 cfg = _config_cache[cfgName]
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
189 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
190 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
191 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
192 return cfg
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
193
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
194
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
195 # 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
196 # 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
197 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
198 return text
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
199
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
200
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
201 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
202 """ 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
203 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
204
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
3215
f12af017cfd1 fix DefaultConfig to be a new style class (it is using properties!)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3175
diff changeset
206 class DefaultConfig(object):
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
207 """ Configuration base class with default config values
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
208 (added below)
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
209 """
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
210
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
211 def __init__(self, siteid):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
212 """ Init Config instance """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
213 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
214 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
215
1624
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
216 from MoinMoin.Page import ItemCache
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
217 self.cache.meta = ItemCache('meta')
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
218 self.cache.pagelists = ItemCache('pagelists')
1620
a86f20280204 implement and use ItemMetaDataCache
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1615
diff changeset
219
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
220 if self.config_check_enabled:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
221 self._config_check()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
222
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
223 # 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
224 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
225 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
226 self.data_dir = data_dir
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
227 for dirname in ('user', 'cache', 'plugin'):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
228 name = dirname + '_dir'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
229 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
230 setattr(self, name, os.path.abspath(os.path.join(data_dir, dirname)))
855
481c72d4a181 support for common indices directory cfg.xapian_index_dir
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 838
diff changeset
231
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
232 # 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
233 self._decode()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
234
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
235 # 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
236 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
237 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
238 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
239 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
240
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
241 # 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
242 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
243 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
244 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
245 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
246
1557
60067807cf9a Allow empty strings for ua_spiders.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1555
diff changeset
247 self.cache.ua_spiders = self.ua_spiders and re.compile(self.ua_spiders, re.I)
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
248
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
249 self._check_directories()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
250
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
251 if not isinstance(self.superuser, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
252 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
253 (e.g. ['Sample User', 'AnotherUser']).
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
254 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
255 raise error.ConfigurationError(msg)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
256
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
257 self._loadPluginModule()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
258
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
259 # Preparse user dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
260 self._fillDicts()
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
261
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
262 # Normalize values
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
263 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
264
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
265 # 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
266 if self.logo_string is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
267 self.logo_string = self.sitename
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
268
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
269 # Check for needed modules
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
270
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
271 # 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
272 # 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
273 # 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
274 # current code.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
275 if self.chart_options:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
276 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
277 import gdchart
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
278 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
279 self.chart_options = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
280
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
281 # post process
2430
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
282
3761
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
283 # '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
284 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
285 self.auth_login_inputs = []
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
286 found_names = []
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
287 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
288 if not auth.name:
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
289 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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 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
298 self.auth_have_login = len(self.auth_login_inputs) > 0
24e9fecdd81c config: move auth post-processing to proper place
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3760
diff changeset
299
2430
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
300 # 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
301 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
302
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
303 # 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
304 # 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
305 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
306 self.backup_exclude = [elem % self for elem in self.backup_exclude]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
307
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
308 # 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
309 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
310 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
311 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
312 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
313 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
314 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
315
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
316 # 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
317 self.xapian_searchers = []
706
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 # 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
320 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
321 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
322
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
323 # 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
324 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
325
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
326 # 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
327 if self.jabber_enabled:
2336
10be78f1fa97 Merge main.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2331 2286
diff changeset
328
2331
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
329 errmsg = "You must set a (long) secret string to send notifications!"
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
330 try:
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
331 if not self.secret:
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
332 raise error.ConfigurationError(errmsg)
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
333 except AttributeError, err:
3175
2a3a6cb34e45 pylint findings: fix some harmless stuff
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3157
diff changeset
334 raise error.ConfigurationError(errmsg)
2336
10be78f1fa97 Merge main.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2331 2286
diff changeset
335
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
336 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
337 self.notification_server = Server(self.notification_bot_uri, )
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
338
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
339 # 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
340 self._iwid = self._iwid_full = self._meta_dict = None
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
341
1552
f9639ed07af2 using request.cfg.cache more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1549
diff changeset
342 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
343 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
344 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
345
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
346 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
347 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
348 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
349
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
350 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
351 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
352
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
353
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
354 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
355 """ The meta_dict contains meta data about the wiki instance. """
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
356 if getattr(self, "_meta_dict", None) is None:
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
357 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
358 return self._meta_dict
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
359 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
360
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
361 # lazily load iwid(_full)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
362 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
363 def getter(self):
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
364 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
365 self.load_IWID()
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
366 return getattr(self, attr)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
367 return property(getter)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
368 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
369 iwid_full = make_iwid_property("_iwid_full")
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
370
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
371 # lazily create a list of event handlers
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
372 def make_event_handlers_prop():
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
373 def getter(self):
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
374 if getattr(self, "_event_handlers", None) is None:
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
375 self._event_handlers = events.get_handlers(self)
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
376 return getattr(self, "_event_handlers")
3240
e8fcaf99434f config.multiconfig: PEP8 fixed
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3223
diff changeset
377
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
378 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
379 self._event_handlers = new_handlers
3240
e8fcaf99434f config.multiconfig: PEP8 fixed
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3223
diff changeset
380
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
381 return property(getter, setter)
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
382 event_handlers = make_event_handlers_prop()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
383
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
384 def load_IWID(self):
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
385 """ 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
386 globally.
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
387 The IWID is available as cfg.iwid
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
388 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
389 This method is called by the property.
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
390 """
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
391 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
392 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
393 except KeyError:
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
394 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
395 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
396 self.meta_dict.sync()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
397
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
398 self._iwid = iwid
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
399 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
400 self._iwid_full = packLine([iwid, self.interwikiname])
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
401 else:
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
402 self._iwid_full = packLine([iwid])
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
403
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
404 def _config_check(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
405 """ 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
406
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
407 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
408 modules, classes, _private or __magic__ names.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
409
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
410 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
411 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
412 """
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
413 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
414 if not name.startswith('_') and
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1799
diff changeset
415 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
416 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
417 if unknown:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
418 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
419 Unknown configuration options: %s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
420
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
421 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
422 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
423 """ % ', '.join(unknown)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
424 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
425
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
426 def _decode(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
427 """ 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
428
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
429 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
430
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
431 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
432 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
433 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
434
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
435 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
436 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
437 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
438 config files.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
439 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
440 charset = 'utf-8'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
441 message = u'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
442 "%(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
443 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
444
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
445 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
446 file. It should match the actual charset of the configuration file.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
447 '''
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
448
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
449 decode_names = (
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
450 'sitename', 'logo_string', 'navi_bar', 'page_front_page',
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
451 '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
452 '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
453 '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
454 '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
455 )
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
456
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
457 for name in decode_names:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
458 attr = getattr(self, name, None)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
459 if attr:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
460 # Try to decode strings
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
461 if isinstance(attr, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
462 try:
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
463 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
464 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
465 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
466 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
467 # 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
468 elif isinstance(attr, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
469 for i in xrange(len(attr)):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
470 item = attr[i]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
471 if isinstance(item, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
472 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
473 attr[i] = unicode(item, charset)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
474 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
475 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
476 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
477
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
478 def _check_directories(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
479 """ Make sure directories are accessible
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
480
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
481 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
482 execute.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
483 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
484 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
485 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
486 path = getattr(self, attr)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
487
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
488 # 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
489 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
490 continue
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
491
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
492 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
493 if not (os.path.isdir(path_pages) and os.access(path_pages, mode)):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
494 msg = '''
3490
af3460a4cb79 fix some typos in messages / comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3485
diff changeset
495 %(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
496 permissions.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
497
3490
af3460a4cb79 fix some typos in messages / comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3485
diff changeset
498 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
499 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
500 and group.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
501
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
502 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
503 also the spelling of the directory name.
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
504 ''' % {'attr': attr, 'path': path, }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
505 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
506
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
507 def _loadPluginModule(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
508 """ import plugin module under configname.plugin
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
509
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
510 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
511 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
512 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
513
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
514 Since each wiki has unique plugins, we load the plugin package
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
515 under the wiki configuration module, named self.siteid.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
516 """
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1787
diff changeset
517 import imp
706
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 name = self.siteid + '.plugin'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
520 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
521 # 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
522 imp.acquire_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
523 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
524 # If the module is not loaded, try to load it
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
525 if not name in sys.modules:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
526 # Find module on disk and try to load - slow!
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
527 plugin_parent_dir = os.path.abspath(os.path.join(self.plugin_dir, '..'))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
528 fp, path, info = imp.find_module('plugin', [plugin_parent_dir])
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
529 try:
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
530 # Load the module and set in sys.modules
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
531 module = imp.load_module(name, fp, path, info)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
532 sys.modules[self.siteid].plugin = module
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
533 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
534 # Make sure fp is closed properly
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
535 if fp:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
536 fp.close()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
537 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
538 imp.release_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
539 except ImportError, err:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
540 msg = '''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
541 Could not import plugin package "%(path)s/plugin" because of ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
542 %(err)s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
543
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
544 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
545 that the data/plugin directory has an __init__.py file.
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
546 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
547 'path': self.data_dir,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
548 '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
549 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
550 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
551
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
552 def _fillDicts(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
553 """ fill config dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
554
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
555 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
556 them from this base class.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
557 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
558 # user checkbox defaults
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
559 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
560 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
561 self.user_checkbox_defaults[key] = value
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
562
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
563 def __getitem__(self, item):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
564 """ 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
565 return getattr(self, item)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
566
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
567
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
568 def _default_password_checker(request, username, password):
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
569 """ 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
570 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
571
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
572 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
573 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
574
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
575 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
576
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
577 @return: None if there is no problem with the password,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
578 some string with an error msg, if the password is problematic.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
579 """
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
580
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
581 try:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
582 # in any case, do a very simple built-in check to avoid the worst passwords
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
583 if len(password) < 6:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
584 raise ValueError("Password too short.")
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
585 if len(set(password)) < 4:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
586 raise ValueError("Password has not enough different characters.")
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
587
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
588 username_lower = username.lower()
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
589 password_lower = password.lower()
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
590 if username in password or password in username or \
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
591 username_lower in password_lower or password_lower in username_lower:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
592 raise ValueError("Password too easy (containment).")
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
593
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
594 keyboards = (ur"`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./", # US kbd
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
595 ur"^1234567890ß´qwertzuiopü+asdfghjklöä#yxcvbnm,.-", # german kbd
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
596 ) # add more keyboards!
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
597 for kbd in keyboards:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
598 rev_kbd = kbd[::-1]
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
599 if password in kbd or password in rev_kbd or \
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
600 password_lower in kbd or password_lower in rev_kbd:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
601 raise ValueError("Password too easy (kbd sequence)")
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
602 return None
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
603 except ValueError, err:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
604 return str(err)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
605
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
606
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
607 class DefaultExpression(object):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
608 def __init__(self, exprstr):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
609 self.text = exprstr
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
610 self.value = eval(exprstr)
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
611
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
612 options_no_group_name = {
3749
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
613 'session': ('Session settings', None, (
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
614 ('session_handler', DefaultExpression('session.DefaultSessionHandler()'),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
615 "See HelpOnSessions."),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
616 ('session_id_handler', DefaultExpression('session.MoinCookieSessionIDHandler()'),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
617 "Only used by the DefaultSessionHandler, see HelpOnSessions."),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
618 ('cookie_domain', None, None),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
619 ('cookie_path', None, None),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
620 ('cookie_lifetime', 12, None),
3750
d5b786be06d7 make anonymous_session_lifetime a proper setting
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3749
diff changeset
621 ('anonymous_session_lifetime', None,
d5b786be06d7 make anonymous_session_lifetime a proper setting
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3749
diff changeset
622 'Session lifetime of users who are not logged in.'),
3749
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
623 )),
b0d5f7f41d4b split out session settings
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3748
diff changeset
624
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
625 'various': ('Various', None, (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
626 ('DesktopEdition',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
627 False,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
628 'True gives all local users special powers - ONLY use for MMDE style usage!'),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
629 ('SecurityPolicy',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
630 None,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
631 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
632
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
633 ('actions_excluded',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
634 ['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
635 '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
636 '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
637 ],
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
638 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
639
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
640 ('allow_xslt', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
641 ('antispam_master_url', "http://master.moinmo.in/?action=xmlrpc2", None),
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
642 ('auth', DefaultExpression('[MoinAuth()]'), None),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
643 ('auth_methods_trusted', ['http', 'xmlrpc_applytoken'], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
644
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
645 ('bang_meta', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
646 ('caching_formats', ['text_html'], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
647 ('changed_time_fmt', '%H:%M', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
648
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
649 ('chart_options', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
650
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
651 ('config_check_enabled', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
652
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
653 ('data_dir', './data/', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
654 ('data_underlay_dir', './underlay/', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
655
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
656 ('date_fmt', '%Y-%m-%d', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
657 ('datetime_fmt', '%Y-%m-%d %H:%M:%S', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
658
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
659 ('default_markup', 'wiki', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
660 ('docbook_html_dir', r"/usr/share/xml/docbook/stylesheet/nwalsh/html/", None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
661
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
662 ('edit_bar', ['Edit', 'Comments', 'Discussion', 'Info', 'Subscribe', 'Quicklink', 'Attachments', 'ActionsMenu'], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
663 ('editor_default', 'text', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
664 ('editor_force', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
665 ('editor_ui', 'freechoice', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
666 ('editor_quickhelp', {
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
667 # editor markup hints quickhelp
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
668 # MUST be in wiki markup, even if the help is not for the wiki parser!
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
669 'wiki': _(u"""\
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
670 Emphasis:: <<Verbatim('')>>''italics''<<Verbatim('')>>; <<Verbatim(''')>>'''bold'''<<Verbatim(''')>>; <<Verbatim(''''')>>'''''bold italics'''''<<Verbatim(''''')>>; <<Verbatim('')>>''mixed ''<<Verbatim(''')>>'''''bold'''<<Verbatim(''')>> and italics''<<Verbatim('')>>; <<Verbatim(----)>> horizontal rule.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
671 Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
672 Lists:: space and one of: * bullets; 1., a., A., i., I. numbered items; 1.#n start numbering at n; space alone indents.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
673 Links:: <<Verbatim(JoinCapitalizedWords)>>; <<Verbatim([[target|linktext]])>>.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
674 Tables:: || cell text |||| cell text spanning 2 columns ||; no trailing white space allowed after tables or titles.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
675
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
676 (!) For more help, see HelpOnEditing or SyntaxReference.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
677 """),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
678 'rst': _("""\
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
679 {{{
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
680 Emphasis: *italic* **bold** ``monospace``
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
681
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
682 Headings: Heading 1 Heading 2 Heading 3
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
683 ========= --------- ~~~~~~~~~
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
684
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
685 Horizontal rule: ----
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
686
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
687 Links: TrailingUnderscore_ `multi word with backticks`_ external_
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
688
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
689 .. _external: http://external-site.example.org/foo/
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
690
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
691 Lists: * bullets; 1., a. numbered items.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
692 }}}
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
693 (!) For more help, see the
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
694 [[http://docutils.sourceforge.net/docs/user/rst/quickref.html|reStructuredText Quick Reference]].
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
695 """),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
696 'creole': _(u"""\
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
697 Emphasis:: <<Verbatim(//)>>''italics''<<Verbatim(//)>>; <<Verbatim(**)>>'''bold'''<<Verbatim(**)>>; <<Verbatim(**//)>>'''''bold italics'''''<<Verbatim(//**)>>; <<Verbatim(//)>>''mixed ''<<Verbatim(**)>>'''''bold'''<<Verbatim(**)>> and italics''<<Verbatim(//)>>;
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
698 Horizontal Rule:: <<Verbatim(----)>>
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
699 Force Linebreak:: <<Verbatim(\\\\)>>
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
700 Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
701 Lists:: * bullets; ** sub-bullets; # numbered items; ## numbered sub items.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
702 Links:: <<Verbatim([[target]])>>; <<Verbatim([[target|linktext]])>>.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
703 Tables:: |= header text | cell text | more cell text |;
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 (!) For more help, see HelpOnEditing or HelpOnCreoleSyntax.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
706 """),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
707 }, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
708 ('edit_locking', 'warn 10', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
709 ('edit_ticketing', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
710 ('edit_rows', 20, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
711
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
712 ('history_count', (100, 200), None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
713
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
714 ('hosts_deny', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
715
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
716 ('html_head', '', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
717 ('html_head_queries', '''<meta name="robots" content="noindex,nofollow">\n''', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
718 ('html_head_posts', '''<meta name="robots" content="noindex,nofollow">\n''', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
719 ('html_head_index', '''<meta name="robots" content="index,follow">\n''', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
720 ('html_head_normal', '''<meta name="robots" content="index,nofollow">\n''', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
721 ('html_pagetitle', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
722
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
723 ('interwikiname', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
724 ('interwiki_preferred', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
725
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
726 ('language_default', 'en', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
727 ('language_ignore_browser', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
728
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
729 ('logo_string', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
730
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
731 ('log_reverse_dns_lookups', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
732 ('log_timing', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
733
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
734 # 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
735 # 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
736 # 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
737 ('mimetypes_xss_protect',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
738 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
739 'text/html',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
740 '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
741 'application/xhtml+xml',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
742 ], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
743
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
744 ('mimetypes_embed',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
745 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
746 'application/x-dvi',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
747 'application/postscript',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
748 'application/pdf',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
749 'application/ogg',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
750 'application/vnd.visio',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
751 '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
752 'image/svg+xml',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
753 'image/tiff',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
754 'image/x-photoshop',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
755 'audio/mpeg',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
756 'audio/midi',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
757 'audio/x-wav',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
758 'video/fli',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
759 'video/mpeg',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
760 'video/quicktime',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
761 'video/x-msvideo',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
762 'chemical/x-pdb',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
763 'x-world/x-vrml',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
764 ], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
765
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
766
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
767 ('navi_bar', [u'RecentChanges', u'FindPage', u'HelpContents', ], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
768
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
769 ('notification_bot_uri', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
770
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
771 ('page_credits',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
772 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
773 '<a href="http://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin Powered</a>',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
774 '<a href="http://moinmo.in/Python" title="MoinMoin is written in Python.">Python Powered</a>',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
775 '<a href="http://moinmo.in/GPL" title="MoinMoin is GPL licensed.">GPL licensed</a>',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
776 '<a href="http://validator.w3.org/check?uri=referer" title="Click here to validate this page.">Valid HTML 4.01</a>',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
777 ], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
778
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
779 ('page_footer1', '', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
780 ('page_footer2', '', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
781 ('page_header1', '', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
782 ('page_header2', '', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
783
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
784 ('page_front_page', u'HelpOnLanguages', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
785 ('page_local_spelling_words', u'LocalSpellingWords', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
786
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
787 # the following regexes should match the complete name when used in free text
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
788 # the group 'all' shall match all, while the group 'key' shall match the key only
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
789 # e.g. CategoryFoo -> group 'all' == CategoryFoo, group 'key' == Foo
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
790 # moin's code will add ^ / $ at beginning / end when needed
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
791 ('page_category_regex', ur'(?P<all>Category(?P<key>\S+))', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
792 ('page_dict_regex', ur'(?P<all>(?P<key>\S+)Dict)', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
793 ('page_group_regex', ur'(?P<all>(?P<key>\S+)Group)', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
794 ('page_template_regex', ur'(?P<all>(?P<key>\S+)Template)', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
795
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
796 ('page_license_enabled', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
797 ('page_license_page', u'WikiLicense', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
798
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
799 # These icons will show in this order in the iconbar, unless they
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
800 # are not relevant, e.g email icon when the wiki is not configured
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
801 # for email.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
802 ('page_iconbar', ["up", "edit", "view", "diff", "info", "subscribe", "raw", "print", ], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
803
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
804 # Standard buttons in the iconbar
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
805 ('page_icons_table',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
806 {
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
807 # key pagekey, querystr dict, title, icon-key
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
808 'diff': ('page', {'action': 'diff'}, _("Diffs"), "diff"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
809 'info': ('page', {'action': 'info'}, _("Info"), "info"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
810 'edit': ('page', {'action': 'edit'}, _("Edit"), "edit"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
811 'unsubscribe': ('page', {'action': 'unsubscribe'}, _("UnSubscribe"), "unsubscribe"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
812 'subscribe': ('page', {'action': 'subscribe'}, _("Subscribe"), "subscribe"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
813 'raw': ('page', {'action': 'raw'}, _("Raw"), "raw"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
814 'xml': ('page', {'action': 'show', 'mimetype': 'text/xml'}, _("XML"), "xml"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
815 'print': ('page', {'action': 'print'}, _("Print"), "print"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
816 'view': ('page', {}, _("View"), "view"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
817 'up': ('page_parent_page', {}, _("Up"), "up"),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
818 }, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
819
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
820
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
821
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
822 ('password_checker', DefaultExpression('_default_password_checker'), None),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
823
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
824 ('quicklinks_default', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
825
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
826 ('refresh', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
827 ('rss_cache', 60, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
828
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
829 ('search_results_per_page', 25, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
830
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
831 ('shared_intermap', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
832
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
833 ('show_hosts', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
834 ('show_interwiki', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
835 ('show_names', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
836 ('show_section_numbers', 0, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
837 ('show_timings', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
838 ('show_version', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
839
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
840 ('sistersites', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
841
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
842 ('siteid', 'default', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
843 ('sitename', u'Untitled Wiki', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
844
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
845 ('stylesheets', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
846
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
847 ('subscribed_pages_default', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
848 ('email_subscribed_events_default',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
849 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
850 PageChangedEvent.__name__,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
851 PageRenamedEvent.__name__,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
852 PageDeletedEvent.__name__,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
853 PageCopiedEvent.__name__,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
854 PageRevertedEvent.__name__,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
855 FileAttachedEvent.__name__,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
856 ], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
857 ('jabber_subscribed_events_default', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
858
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
859 ('superuser', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
860
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
861 ('supplementation_page', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
862 ('supplementation_page_name', u'Discussion', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
863 ('supplementation_page_template', u'DiscussionTemplate', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
864
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
865 ('surge_action_limits',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
866 {# allow max. <count> <action> requests per <dt> secs
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
867 # action: (count, dt)
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
868 'all': (30, 30),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
869 'show': (30, 60),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
870 'recall': (10, 120),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
871 'raw': (20, 40), # some people use this for css
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
872 'AttachFile': (90, 60),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
873 'diff': (30, 60),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
874 'fullsearch': (10, 120),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
875 'edit': (30, 300), # can be lowered after making preview different from edit
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
876 'rss_rc': (1, 60),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
877 'default': (30, 60),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
878 }, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
879 ('surge_lockout_time', 3600, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
880
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
881 ('textchas', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
882 ('textchas_disabled_group', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
883
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
884 ('theme_default', 'modern', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
885 ('theme_force', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
886
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
887 ('traceback_show', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
888 ('traceback_log_dir', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
889
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
890 ('trail_size', 5, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
891 ('tz_offset', 0.0, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
892
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
893 # a regex of HTTP_USER_AGENTS that should be excluded from logging
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
894 # and receive a FORBIDDEN for anything except viewing a page
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
895 # list must not contain 'java' because of twikidraw wanting to save drawing uses this useragent
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
896 ('ua_spiders',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
897 ('archiver|cfetch|charlotte|crawler|curl|gigabot|googlebot|heritrix|holmes|htdig|httrack|httpunit|'
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
898 'intelix|jeeves|larbin|leech|libwww-perl|linkbot|linkmap|linkwalk|litefinder|mercator|'
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
899 'microsoft.url.control|mirror| mj12bot|msnbot|msrbot|neomo|nutbot|omniexplorer|puf|robot|scooter|seekbot|'
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
900 'sherlock|slurp|sitecheck|snoopy|spider|teleport|twiceler|voilabot|voyager|webreaper|wget|yeti'),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
901 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
902
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
903 ('unzip_single_file_size', 2.0 * 1000 ** 2, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
904 ('unzip_attachments_space', 200.0 * 1000 ** 2, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
905 ('unzip_attachments_count', 101, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
906
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
907 ('url_mappings', {}, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
908
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
909 # includes the moin version number, so we can have a unlimited cache lifetime
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
910 # for the static stuff. if stuff changes on version upgrade, url will change
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
911 # immediately and we have no problem with stale caches.
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
912 ('url_prefix_static', config.url_prefix_static, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
913 ('url_prefix_local', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
914
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
915 # we could prefix actions to be able to exclude them by robots.txt:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
916 #url_prefix_action', 'action' # no leading or trailing '/'
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
917 ('url_prefix_action', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
918
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
919 # allow disabling certain userpreferences plugins
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
920 ('userprefs_disabled', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
921 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
922 }
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
923
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
924 options = {
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
925 'acl': ('Access control lists', None, (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
926 ('hierarchic', False, 'True to use hierarchical ACLs'),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
927 ('rights_default', u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write", None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
928 ('rights_before', u"", None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
929 ('rights_after', u"", None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
930 ('rights_valid', ['read', 'write', 'delete', 'revert', 'admin'], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
931 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
932
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
933 'xapian': ('Xapian search', None, (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
934 ('search', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
935 ('index_dir', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
936 ('stemming', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
937 ('index_history', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
938 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
939
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
940 'user': ('Users / User settings', None, (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
941 ('autocreate', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
942 ('email_unique', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
943 ('jid_unique', True, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
944
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
945 ('homewiki', 'Self', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
946
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
947 ('checkbox_fields',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
948 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
949 ('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
950 ('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
951 ('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
952 ('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
953 ('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
954 ('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
955 ('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
956 ('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
957 ('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
958 ('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
959 ('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
960
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
961 ('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
962 # 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
963 # 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
964 # 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
965 ],
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
966 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
967
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
968 ('checkbox_defaults',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
969 {
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
970 'mailto_author': 0,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
971 'edit_on_doubleclick': 0,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
972 'remember_last_visit': 0,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
973 'show_comments': 0,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
974 'show_nonexist_qm': False,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
975 'show_page_trail': 1,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
976 'show_toolbar': 1,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
977 'show_topbottom': 0,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
978 'show_fancy_diff': 1,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
979 'wikiname_add_spaces': 0,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
980 'remember_me': 1,
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
981 },
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
982 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
983
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
984 ('checkbox_disable', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
985
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
986 ('checkbox_remove', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
987
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
988 ('form_fields',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
989 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
990 ('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
991 ('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
992 ('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
993 ('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
994 ('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
995 ('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
996 ],
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
997 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
998
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
999 ('form_defaults',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1000 { # key: default - do NOT remove keys from here!
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1001 'name': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1002 'aliasname': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1003 'password': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1004 'password2': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1005 'email': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1006 'jid': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1007 'css_url': '',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1008 'edit_rows': "20",
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1009 },
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1010 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1011
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1012 ('form_disable', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1013
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1014 ('form_remove', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1015
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1016 ('transient_fields',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1017 ['id', 'valid', 'may', 'auth_username', 'password', 'password2', 'auth_method', 'auth_attribs', ],
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1018 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1019 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1020
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1021 'backup': ('Backup', None, (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1022 ('compression', 'gz', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1023 ('users', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1024 ('include', [], None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1025 ('exclude',
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1026 [
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1027 r"(.+\.py(c|o)$)",
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1028 r"%(cache_dir)s",
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1029 r"%(/)spages%(/)s.+%(/)scache%(/)s[^%(/)s]+$" % {'/': os.sep},
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1030 r"%(/)s(edit-lock|event-log|\.DS_Store)$" % {'/': os.sep},
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1031 ],
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1032 None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1033 ('storage_dir', '/tmp', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1034 ('restore_target_dir', '/tmp', None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1035 )),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1036
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1037 'openid_server': ('OpenID Server',
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1038 '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
1039 (
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1040 ('enabled', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1041 ('restricted_users_group', None, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1042 ('enable_user', False, None),
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1043 )),
3746
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1044
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1045 'mail': ('Mail settings',
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1046 '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
1047 (
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1048 ('from', None, None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1049 ('login', None, None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1050 ('smarthost', None, None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1051 ('sendmail', None, None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1052
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1053 ('import_secret', "", None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1054 ('import_subpage_template', u"$from-$date-$subject", None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1055 ('import_pagename_search', ['subject', 'to', ], None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1056 ('import_pagename_envelope', u"%s", None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1057 ('import_pagename_regex', r'\[\[([^\]]*)\]\]', None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1058 ('import_wiki_addrs', [], None),
510db268574b make mail settings group
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
1059 )),
3740
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1060 }
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1061
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1062 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
1063 for groupname in opts:
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3741
diff changeset
1064 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
1065 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
1066 if addgroup:
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1067 name = groupname + '_' + name
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
1068 if isinstance(default, DefaultExpression):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3747
diff changeset
1069 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
1070 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
1071
67e6b9620ae0 move all default settings into a dict/list structure
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3738
diff changeset
1072 _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
1073 _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
1074
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
1075 # remove the gettext pseudo function
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1076 del _