annotate MoinMoin/config/multiconfig.py @ 1920:b06ef2a53efa

'make pylint', fixed lots of minor stuff found by pylint (and there is still lots left to do)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 30 Mar 2007 21:50:50 +0200
parents bb2e053067fb
children aa6aa944246b
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>,
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1868
diff changeset
6 2005-2006 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
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
14
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
15 from MoinMoin import config, error, util, wikiutil
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
16 import MoinMoin.auth as authmodule
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
17 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
18 from MoinMoin.security import AccessControlList
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
19
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
20 _url_re_cache = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
21 _farmconfig_mtime = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
22 _config_cache = {}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
23
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
24
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
25 def _importConfigModule(name):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
26 """ Import and return configuration module and its modification time
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
27
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
28 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
29 always an error.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
30
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
31 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
32 @rtype: tuple
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
33 @return: module, modification time
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
34 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
35 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
36 module = __import__(name, globals(), {})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
37 mtime = os.path.getmtime(module.__file__)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
38 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
39 raise
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
40 except IndentationError, err:
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
41 msg = '''IndentationError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
42
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
43 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
44 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
45 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
46 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
47 '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
48 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
49 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
50 except Exception, err:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
51 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
52 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
53 return module, mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
54
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
55
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
56 def _url_re_list():
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
57 """ Return url matching regular expression
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
58
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
59 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
60 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
61
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
62 @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
63 @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
64 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
65 global _url_re_cache, _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
66 if _url_re_cache is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
67 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
68 farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig')
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
69 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
70 # Default to wikiconfig for all urls.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
71 _farmconfig_mtime = 0
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
72 _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
73 else:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
74 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
75 cache = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
76 for name, regex in farmconfig.wikis:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
77 cache.append((name, re.compile(regex)))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
78 _url_re_cache = cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
79 except AttributeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
80 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
81 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
82
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
83 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
84 use wikiconfig.py.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
85 """
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
86 raise error.ConfigurationError(msg)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
87 return _url_re_cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
88
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
89
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
90 def _makeConfig(name):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
91 """ Create and return a config instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
92
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
93 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
94 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
95
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
96 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
97 @rtype: DefaultConfig sub class instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
98 @return: new configuration instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
99 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
100 global _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
101 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
102 module, mtime = _importConfigModule(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
103 configClass = getattr(module, 'Config')
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
104 cfg = configClass(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
105 cfg.cfg_mtime = max(mtime, _farmconfig_mtime)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
106 except ImportError, err:
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
107 msg = '''ImportError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
108
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
109 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
110 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
111 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
112 the top of the server script.
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 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
115 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
116 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
117 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
118 '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
119 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
120 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
121 except AttributeError, 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
122 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
123
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
124 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
125
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
126 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
127 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
128
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
129 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
130 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
131 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
132 possible.
706
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 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
135 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
136 ''' % {
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 '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
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)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
141 return cfg
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
142
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
143
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
144 def _getConfigName(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
145 """ 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
146 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
147 match = regex.match(url)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
148 if match:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
149 return name
1575
45f876b6a109 raise NoConfigMatchedError
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1573
diff changeset
150 raise error.NoConfigMatchedError
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
151
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
152
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
153 def getConfig(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
154 """ 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
155
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
156 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
157 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
158 returned, using dict.setdefault.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
159
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
160 @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
161 @rtype: DefaultConfig subclass instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
162 @return: config object for specific wiki
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
163 """
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
164 cfgName = _getConfigName(url)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
165 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
166 cfg = _config_cache[cfgName]
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
167 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
168 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
169 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
170 return cfg
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
171
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
172
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
173 # 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
174 # 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
175 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
176 return text
706
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
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
179 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
180 """ 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
181 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
182
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
183
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
184 class DefaultConfig:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
185 """ default config values """
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
186
1597
bbe187af4fc0 integrated MMDE (build scripts need more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
187 # setting DesktopEdition = True gives all local users special powers - ONLY use for MMDE style usage!
bbe187af4fc0 integrated MMDE (build scripts need more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
188 DesktopEdition = False
bbe187af4fc0 integrated MMDE (build scripts need more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
189
729
8e8130a1f46b some cosmetic changes to config/multiconfig
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 718
diff changeset
190 # All acl_rights_* lines must use unicode!
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
191 acl_rights_default = u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write"
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
192 acl_rights_before = u""
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
193 acl_rights_after = u""
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
194 acl_rights_valid = ['read', 'write', 'delete', 'revert', 'admin']
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
195
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
196 actions_excluded = [] # ['DeletePage', 'AttachFile', 'RenamePage', 'test', ]
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
197 allow_xslt = False
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
198 attachments = None # {'dir': path, 'url': url-prefix}
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
199 auth = [authmodule.moin_login, authmodule.moin_session, ]
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
200
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
201 backup_compression = 'gz'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
202 backup_users = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
203 backup_include = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
204 backup_exclude = [
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
205 r"(.+\.py(c|o)$)",
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
206 r"%(cache_dir)s",
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
207 r"%(/)spages%(/)s.+%(/)scache%(/)s[^%(/)s]+$" % {'/': os.sep},
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
208 r"%(/)s(edit-lock|event-log|\.DS_Store)$" % {'/': os.sep},
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
209 ]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
210 backup_storage_dir = '/tmp'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
211 backup_restore_target_dir = '/tmp'
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
212
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
213 bang_meta = True
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
214 caching_formats = ['text_html']
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
215 changed_time_fmt = '%H:%M'
729
8e8130a1f46b some cosmetic changes to config/multiconfig
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 718
diff changeset
216
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
217 # chars_{upper,lower,digits,spaces} see MoinMoin/util/chartypes.py
729
8e8130a1f46b some cosmetic changes to config/multiconfig
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 718
diff changeset
218
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
219 # if you have gdchart, add something like
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
220 # chart_options = {'width = 720, 'height': 540}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
221 chart_options = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
222
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
223 config_check_enabled = False
770
1c76112a5ff6 removed some unneeded configurability, default value for cfg.cookie_secret
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 751
diff changeset
224
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
225 cookie_domain = None # use '.domain.tld" for a farm with hosts in that domain
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
226 cookie_path = None # use '/wikifarm" for a farm with pathes below that path
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
227 cookie_lifetime = 12 # 12 hours from now
770
1c76112a5ff6 removed some unneeded configurability, default value for cfg.cookie_secret
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 751
diff changeset
228 cookie_secret = '1234' # secret value for crypting session cookie - you should change this :)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
229
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
230 data_dir = './data/'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
231 data_underlay_dir = './underlay/'
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
232
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
233 date_fmt = '%Y-%m-%d'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
234 datetime_fmt = '%Y-%m-%d %H:%M:%S'
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
235
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
236 default_markup = 'wiki'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
237 docbook_html_dir = r"/usr/share/xml/docbook/stylesheet/nwalsh/html/" # correct for debian sarge
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
238
1752
6f8360e1a4bb wrapping div support for wiki parser, toggling display of comment divs, show_comments user prefs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1741
diff changeset
239 edit_bar = ['Edit', 'Comments', 'Discussion', 'Info', 'Subscribe', 'Quicklink', 'Attachments', 'ActionsMenu']
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
240 editor_default = 'text' # which editor is called when nothing is specified
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
241 editor_ui = 'freechoice' # which editor links are shown on user interface
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
242 editor_force = False
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
243 editor_quickhelp = {# editor markup hints quickhelp
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
244 'wiki': _("""\
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
245 Emphasis:: [[Verbatim('')]]''italics''[[Verbatim('')]]; [[Verbatim(''')]]'''bold'''[[Verbatim(''')]]; [[Verbatim(''''')]]'''''bold italics'''''[[Verbatim(''''')]]; [[Verbatim('')]]''mixed ''[[Verbatim(''')]]'''''bold'''[[Verbatim(''')]] and italics''[[Verbatim('')]]; [[Verbatim(----)]] horizontal rule.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
246 Headings:: [[Verbatim(=)]] Title 1 [[Verbatim(=)]]; [[Verbatim(==)]] Title 2 [[Verbatim(==)]]; [[Verbatim(===)]] Title 3 [[Verbatim(===)]]; [[Verbatim(====)]] Title 4 [[Verbatim(====)]]; [[Verbatim(=====)]] Title 5 [[Verbatim(=====)]].
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
247 Lists:: space and one of: * bullets; 1., a., A., i., I. numbered items; 1.#n start numbering at n; space alone indents.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
248 Links:: [[Verbatim(JoinCapitalizedWords)]]; [[Verbatim(["brackets and double quotes"])]]; url; [url]; [url label].
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
249 Tables:: || cell text |||| cell text spanning 2 columns ||; no trailing white space allowed after tables or titles.
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 (!) For more help, see HelpOnEditing or SyntaxReference.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
252 """),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
253 'rst': _("""\
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
254 Emphasis: <i>*italic*</i> <b>**bold**</b> ``monospace``<br/>
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
255 <br/><pre>
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
256 Headings: Heading 1 Heading 2 Heading 3
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
257 ========= --------- ~~~~~~~~~
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 Horizontal rule: ----
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
260 Links: TrailingUnderscore_ `multi word with backticks`_ external_
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
261
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
262 .. _external: http://external-site.net/foo/
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
263
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
264 Lists: * bullets; 1., a. numbered items.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
265 </pre>
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
266 <br/>
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
267 (!) For more help, see the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
268 <a href="http://docutils.sourceforge.net/docs/user/rst/quickref.html">
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
269 reStructuredText Quick Reference
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
270 </a>.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
271 """),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
272 }
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
273 edit_locking = 'warn 10' # None, 'warn <timeout mins>', 'lock <timeout mins>'
1573
1453513eaa7e use tickets for editing, cfg.edit_ticketing, make tickets more safe, invalidate old tickets
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1557
diff changeset
274 edit_ticketing = True
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
275 edit_rows = 20
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
276
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
277 hacks = {} # { 'feature1': value1, ... }
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
278 # Configuration for features still in development.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
279 # For boolean stuff just use config like this:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
280 # hacks = { 'feature': True, ...}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
281 # and in the code use:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
282 # if cfg.hacks.get('feature', False): <doit>
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
283 # A non-existing hack key should ever mean False, None, "", [] or {}!
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
284
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
285 hosts_deny = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
286
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
287 html_head = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
288 html_head_queries = '''<meta name="robots" content="noindex,nofollow">\n'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
289 html_head_posts = '''<meta name="robots" content="noindex,nofollow">\n'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
290 html_head_index = '''<meta name="robots" content="index,follow">\n'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
291 html_head_normal = '''<meta name="robots" content="index,nofollow">\n'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
292 html_pagetitle = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
293
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
294 interwiki_preferred = [] # list of wiki names to show at top of interwiki list
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
295
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
296 language_default = 'en'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
297 language_ignore_browser = False # ignore browser settings, use language_default
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
298 # or user prefs
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
299
838
910ed4667859 cfg.log_reverse_dns_lookups = False for disabling reverse dns lookup on networks with broken rdns
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 825
diff changeset
300 log_reverse_dns_lookups = True # if we do reverse dns lookups for logging hostnames
910ed4667859 cfg.log_reverse_dns_lookups = False for disabling reverse dns lookup on networks with broken rdns
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 825
diff changeset
301 # instead of just IPs
910ed4667859 cfg.log_reverse_dns_lookups = False for disabling reverse dns lookup on networks with broken rdns
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 825
diff changeset
302
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
303 xapian_search = False # disabled until xapian is finished
859
c76dd5d97e0e small fixes and cleanups
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 855
diff changeset
304 xapian_index_dir = None
916
d0af8dce4d0e Xapian.use_stemming -> request.cfg.xapian_stemming and stemming lang bugfix
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 859
diff changeset
305 xapian_stemming = True
1441
05482b439f89 optional history indexing and search is working
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1339
diff changeset
306 xapian_index_history = True
1205
73f576c4bca3 fix multiconfig merge and more informative SystemInfo macro
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 1011
diff changeset
307 search_results_per_page = 10
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
308
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
309 mail_login = None # or "user pwd" if you need to use SMTP AUTH
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
310 mail_sendmail = None # "/usr/sbin/sendmail -t -i" to not use SMTP, but sendmail
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
311 mail_smarthost = None
718
7df204e270ff Mail import - Added support for 8 bit mails, renamed config fields from email_ to mail_import_, added support for DateTime macro, fixed table recognition.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 715
diff changeset
312 mail_from = None # u'Juergen Wiki <noreply@jhwiki.org>'
7df204e270ff Mail import - Added support for 8 bit mails, renamed config fields from email_ to mail_import_, added support for DateTime macro, fixed table recognition.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 715
diff changeset
313
7df204e270ff Mail import - Added support for 8 bit mails, renamed config fields from email_ to mail_import_, added support for DateTime macro, fixed table recognition.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 715
diff changeset
314 mail_import_subpage_template = u"$from-$date-$subject" # used for mail import
1687
1d358ccc0f2f mail_import_pagename_search determines where and in which order to look for target pagename
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1684
diff changeset
315 mail_import_pagename_search = ['subject', 'to', ] # where to look for target pagename (and in which order)
1615
9fa2ec252d1f mailimport: add envelope feature for target page spec
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1597
diff changeset
316 mail_import_pagename_envelope = u"%s" # use u"+ %s/" to add "+ " and "/" automatically
1691
d29448b5771d mailimport: use freelink syntax to extract target page from subject, fix some comments/docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1689
diff changeset
317 mail_import_pagename_regex = r'\["([^"]*)"\]' # how to find/extract the pagename from the subject
1658
0dee8ba737af mailimport: allow multiple wiki email addrs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1654
diff changeset
318 mail_import_wiki_addrs = [] # the e-mail addresses for e-mails that should go into the wiki
718
7df204e270ff Mail import - Added support for 8 bit mails, renamed config fields from email_ to mail_import_, added support for DateTime macro, fixed table recognition.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 715
diff changeset
319 mail_import_secret = ""
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
320
1548
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
321 # some dangerous mimetypes (we don't use "content-disposition: inline" for them when a user
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
322 # downloads such attachments, because the browser might execute e.g. Javascript contained
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
323 # in the HTML and steal your moin cookie or do other nasty stuff)
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
324 mimetypes_xss_protect = [
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
325 'text/html',
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
326 'application/x-shockwave-flash',
1555
0eaaba71dfc0 Added XHTML to the unsafe list. Backport necessary.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1552
diff changeset
327 'application/xhtml+xml',
1548
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
328 ]
2eb5117aa7de content-disposition for AttachFile downloads either inline or attachment depending on mimetype in cfg.mimetypes_xss_protect list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1513
diff changeset
329
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
330 navi_bar = [u'RecentChanges', u'FindPage', u'HelpContents', ]
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
331 nonexist_qm = False
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
332
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
333 page_credits = [
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
334 '<a href="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a>',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
335 '<a href="http://www.python.org/">Python Powered</a>',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
336 '<a href="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a>',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
337 ]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
338 page_footer1 = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
339 page_footer2 = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
340
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
341 page_header1 = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
342 page_header2 = ''
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
343
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
344 page_front_page = u'HelpOnLanguages' # this will make people choose a sane config
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
345 page_local_spelling_words = u'LocalSpellingWords'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
346 page_category_regex = u'^Category[A-Z]'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
347 page_dict_regex = u'[a-z0-9]Dict$'
1774
b57dacec0ce3 multiconfig:page_group_regex reverted to CamelCase definition.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1773
diff changeset
348 page_group_regex = u'[a-z0-9]Group$'
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
349 page_template_regex = u'[a-z0-9]Template$'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
350
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
351 page_license_enabled = False
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
352 page_license_page = u'WikiLicense'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
353
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
354 # These icons will show in this order in the iconbar, unless they
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
355 # are not relevant, e.g email icon when the wiki is not configured
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
356 # for email.
1684
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
357 page_iconbar = ["edit", "view", "diff", "info", "subscribe", "raw", "print", ]
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
358
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
359 # Standard buttons in the iconbar
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
360 page_icons_table = {
1684
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
361 # key querystr dict, title, icon-key
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
362 'diff': ({'action': 'diff'}, _("Diffs"), "diff"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
363 'info': ({'action': 'info'}, _("Info"), "info"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
364 'edit': ({'action': 'edit'}, _("Edit"), "edit"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
365 'unsubscribe': ({'action': 'subscribe'}, _("UnSubscribe"), "unsubscribe"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
366 'subscribe': ({'action': 'subscribe'}, _("Subscribe"), "subscribe"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
367 'raw': ({'action': 'raw'}, _("Raw"), "raw"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
368 'xml': ({'action': 'show', 'mimetype': 'text/xml'}, _("XML"), "xml"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
369 'print': ({'action': 'print'}, _("Print"), "print"),
aadc8b0e11cf change classic theme to propagate rev, too
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1658
diff changeset
370 'view': ({}, _("View"), "view"),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
371 }
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
372
1689
7b80735ede14 quicklinks_default and subscribed_pages_default to preload the lists in the user profile
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1688
diff changeset
373 quicklinks_default = [] # preload user quicklinks with this page list
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
374 refresh = None # (minimum_delay, type), e.g.: (2, 'internal')
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
375 rss_cache = 60 # suggested caching time for RecentChanges RSS, in seconds
1787
f4a941fe32f8 added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1774
diff changeset
376 sistersites = {
f4a941fe32f8 added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1774
diff changeset
377 #'Self': 'http://localhost:8080/?action=sisterpages',
f4a941fe32f8 added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1774
diff changeset
378 'EmacsWiki': 'http://www.emacswiki.org/cgi-bin/test?action=sisterpages',
f4a941fe32f8 added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1774
diff changeset
379 'JspWiki': 'http://www.jspwiki.org/SisterSites.jsp',
f4a941fe32f8 added SisterSites/SisterPages support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1774
diff changeset
380 } # dict {sistersitename: sisterpagelistfetchurl}
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
381 shared_intermap = None # can be string or list of strings (filenames)
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
382 show_hosts = True
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
383 show_interwiki = False
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
384 show_login = True
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
385 show_names = True
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
386 show_section_numbers = 0
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
387 show_timings = False
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
388 show_version = False
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
389 siteid = 'default'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
390 stylesheets = [] # list of tuples (media, csshref) to insert after theme css, before user css
1689
7b80735ede14 quicklinks_default and subscribed_pages_default to preload the lists in the user profile
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1688
diff changeset
391 subscribed_pages_default = [] # preload user subscribed pages with this page list
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
392 superuser = [] # list of unicode user names that have super powers :)
1731
d4a424079d50 multiconfig: definition of supplementation_page = False, supplementation_page_name = u'Discussion', supplementation_page_template = u'DiscussionTemplate'
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1691
diff changeset
393 supplementation_page = False
d4a424079d50 multiconfig: definition of supplementation_page = False, supplementation_page_name = u'Discussion', supplementation_page_template = u'DiscussionTemplate'
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1691
diff changeset
394 supplementation_page_name = u'Discussion'
d4a424079d50 multiconfig: definition of supplementation_page = False, supplementation_page_name = u'Discussion', supplementation_page_template = u'DiscussionTemplate'
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1691
diff changeset
395 supplementation_page_template = u'DiscussionTemplate'
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
396 surge_action_limits = {# allow max. <count> <action> requests per <dt> secs
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
397 # action: (count, dt)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
398 'all': (30, 30),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
399 'show': (30, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
400 'recall': (5, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
401 'raw': (20, 40), # some people use this for css
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
402 'AttachFile': (90, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
403 'diff': (30, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
404 'fullsearch': (5, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
405 'edit': (10, 120),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
406 'rss_rc': (1, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
407 'default': (30, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
408 }
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
409 surge_lockout_time = 3600 # secs you get locked out when you ignore warnings
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
410
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
411 theme_default = 'modern'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
412 theme_force = False
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
413
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
414 trail_size = 5
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
415 tz_offset = 0.0 # default time zone offset in hours from UTC
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
416
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
417 user_autocreate = False # do we auto-create user profiles
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
418 user_email_unique = True # do we check whether a user's email is unique?
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
419
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
420 # a regex of HTTP_USER_AGENTS that should be excluded from logging
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
421 # and receive a FORBIDDEN for anything except viewing a page
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
422 ua_spiders = ('archiver|cfetch|crawler|curl|gigabot|googlebot|holmes|htdig|httrack|httpunit|jeeves|larbin|leech|'
1397
3b527a26aa1f added some bots to spider list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1339
diff changeset
423 'linkbot|linkmap|linkwalk|mercator|mirror|msnbot|neomo|nutbot|omniexplorer|puf|robot|scooter|seekbot|'
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
424 'sherlock|slurp|sitecheck|spider|teleport|voyager|webreaper|wget')
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 # Wiki identity
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
427 sitename = u'Untitled Wiki'
1318
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
428
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
429 # url_prefix is DEPRECATED and not used any more by the code.
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
430 # it confused many people by its name and default value of '/wiki' to the
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
431 # wrong conclusion that it is the url of the wiki (the dynamic) stuff,
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
432 # but it was used to address the static stuff (images, css, js).
1799
06ce4843b9b5 remove some XXX strings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
433 # Thus we use the more clear url_prefix_static ['/moin_staticVVV'] setting now.
1318
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
434 # For a limited time, we still look at url_prefix - if it is not None, we
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
435 # copy the value to url_prefix_static to ease transition.
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
436 url_prefix = None
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
437
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
438 # includes the moin version number, so we can have a unlimited cache lifetime
1318
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
439 # for the static stuff. if stuff changes on version upgrade, url will change
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
440 # immediately and we have no problem with stale caches.
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
441 url_prefix_static = config.url_prefix_static
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
442 url_prefix_local = None # if None, use same value as 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
443 # must be same site as wiki engine (for e.g. JS permissions)
1318
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
444
1417
76cd1916b7e4 Changed the default value of url_prefix_action to None to get the old behaviour with nicer URLs. Documented this in CHANGES.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1397
diff changeset
445 # we could prefix actions to be able to exclude them by robots.txt:
76cd1916b7e4 Changed the default value of url_prefix_action to None to get the old behaviour with nicer URLs. Documented this in CHANGES.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1397
diff changeset
446 #url_prefix_action = 'action' # no leading or trailing '/'
76cd1916b7e4 Changed the default value of url_prefix_action to None to get the old behaviour with nicer URLs. Documented this in CHANGES.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1397
diff changeset
447 url_prefix_action = None # compatiblity
1318
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
448
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
449 logo_string = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
450 interwikiname = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
451
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
452 url_mappings = {}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
453
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
454 user_checkbox_fields = [
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
455 ('mailto_author', lambda _: _('Publish my email (not my wiki homepage) in author info')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
456 ('edit_on_doubleclick', lambda _: _('Open editor on double click')),
877
9bb19e35d5a8 changed wording, as we don't jump to frontpage any more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 859
diff changeset
457 ('remember_last_visit', lambda _: _('After login, jump to last visited page')),
1752
6f8360e1a4bb wrapping div support for wiki parser, toggling display of comment divs, show_comments user prefs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1741
diff changeset
458 ('show_comments', lambda _: _('Show comment sections')),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
459 ('show_nonexist_qm', lambda _: _('Show question mark for non-existing pagelinks')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
460 ('show_page_trail', lambda _: _('Show page trail')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
461 ('show_toolbar', lambda _: _('Show icon toolbar')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
462 ('show_topbottom', lambda _: _('Show top/bottom links in headings')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
463 ('show_fancy_diff', lambda _: _('Show fancy diffs')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
464 ('wikiname_add_spaces', lambda _: _('Add spaces to displayed wiki names')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
465 ('remember_me', lambda _: _('Remember login information')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
466 ('want_trivial', lambda _: _('Subscribe to trivial changes')),
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
467
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
468 ('disabled', lambda _: _('Disable this account forever')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
469 # if an account is disabled, it may be used for looking up
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
470 # id -> username for page info and recent changes, but it
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
471 # is not usable for the user any more:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
472 ]
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
473
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
474 user_checkbox_defaults = {'mailto_author': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
475 'edit_on_doubleclick': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
476 'remember_last_visit': 0,
1752
6f8360e1a4bb wrapping div support for wiki parser, toggling display of comment divs, show_comments user prefs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1741
diff changeset
477 'show_comments': 0,
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
478 'show_nonexist_qm': nonexist_qm,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
479 'show_page_trail': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
480 'show_toolbar': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
481 'show_topbottom': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
482 'show_fancy_diff': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
483 'wikiname_add_spaces': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
484 'remember_me': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
485 'want_trivial': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
486 }
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 # don't let the user change those
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
489 # user_checkbox_disable = ['disabled', 'want_trivial']
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
490 user_checkbox_disable = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
491
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
492 # remove those checkboxes:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
493 #user_checkbox_remove = ['edit_on_doubleclick', 'show_nonexist_qm', 'show_toolbar', 'show_topbottom',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
494 # 'show_fancy_diff', 'wikiname_add_spaces', 'remember_me', 'disabled',]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
495 user_checkbox_remove = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
496
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
497 user_form_fields = [
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
498 ('name', _('Name'), "text", "36", _("(Use Firstname''''''Lastname)")),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
499 ('aliasname', _('Alias-Name'), "text", "36", ''),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
500 ('password', _('Password'), "password", "36", ''),
738
0631cda1fbf8 better explanation for 2nd password field
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 737
diff changeset
501 ('password2', _('Password repeat'), "password", "36", _('(Only for password change or new account)')),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
502 ('email', _('Email'), "text", "36", ''),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
503 ('css_url', _('User CSS URL'), "text", "40", _('(Leave it empty for disabling user CSS)')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
504 ('edit_rows', _('Editor size'), "text", "3", ''),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
505 ]
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
506
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
507 user_form_defaults = {# key: default - do NOT remove keys from here!
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
508 'name': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
509 'aliasname': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
510 'password': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
511 'password2': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
512 'email': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
513 'css_url': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
514 'edit_rows': "20",
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
515 }
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
516
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
517 # don't let the user change those, but show them:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
518 #user_form_disable = ['name', 'aliasname', 'email',]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
519 user_form_disable = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
520
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
521 # remove those completely:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
522 #user_form_remove = ['password', 'password2', 'css_url', 'logout', 'create', 'account_sendmail',]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
523 user_form_remove = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
524
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
525 # attributes we do NOT save to the userpref file
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
526 user_transient_fields = ['id', 'valid', 'may', 'auth_username', 'trusted', 'password', 'password2', 'auth_method', 'auth_attribs', ]
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
527
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
528 user_homewiki = 'Self' # interwiki name for where user homepages are located
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
529
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
530 unzip_single_file_size = 2.0 * 1000**2
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
531 unzip_attachments_space = 200.0 * 1000**2
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
532 unzip_attachments_count = 51 # 1 zip file + 50 files contained in it
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
533
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
534 xmlrpc_putpage_enabled = False # if False, putpage will write to a test page only
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
535 xmlrpc_putpage_trusted_only = True # if True, you will need to be http auth authenticated
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
536
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
537 SecurityPolicy = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
538
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
539 def __init__(self, siteid):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
540 """ Init Config instance """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
541 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
542 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
543
1624
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
544 from MoinMoin.Page import ItemCache
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
545 self.cache.meta = ItemCache('meta')
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
546 self.cache.pagelists = ItemCache('pagelists')
1620
a86f20280204 implement and use ItemMetaDataCache
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1615
diff changeset
547
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
548 if self.config_check_enabled:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
549 self._config_check()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
550
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
551 # 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
552 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
553 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
554 self.data_dir = data_dir
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
555 for dirname in ('user', 'cache', 'plugin'):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
556 name = dirname + '_dir'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
557 if not getattr(self, name, None):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
558 setattr(self, name, 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
559
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
560 # 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
561 self._decode()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
562
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
563 # 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
564 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
565 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
566 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
567 self.cache.page_template_regex = re.compile(self.page_template_regex, re.UNICODE)
1557
60067807cf9a Allow empty strings for ua_spiders.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1555
diff changeset
568 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
569
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
570 self._check_directories()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
571
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
572 if not isinstance(self.superuser, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
573 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
574 (e.g. ['Sample User', 'AnotherUser']).
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
575 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
576 raise error.ConfigurationError(msg)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
577
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
578 self._loadPluginModule()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
579
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
580 # Preparse user dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
581 self._fillDicts()
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
582
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
583 # Normalize values
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
584 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
585
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
586 # 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
587 if self.logo_string is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
588 self.logo_string = self.sitename
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
589
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
590 # Check for needed modules
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
591
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
592 # 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
593 # 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
594 # 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
595 # current code.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
596 if self.chart_options:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
597 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
598 import gdchart
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
599 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
600 self.chart_options = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
601
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
602 # post process
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
603 # 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
604 # 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
605 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
606 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
607
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
608 # 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
609 self.xapian_searchers = []
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
610
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
611 # 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
612 self.mail_enabled = (self.mail_smarthost is not None or self.mail_sendmail is not None) and self.mail_from
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
613
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
614 # 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
615 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
616
1552
f9639ed07af2 using request.cfg.cache more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1549
diff changeset
617 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
618 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
619 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
620
1318
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
621 if self.url_prefix is not None: # remove this code when url_prefix setting is removed
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
622 self.url_prefix_static = self.url_prefix
760002b5ffa3 use url_prefix_static = '/moin_static160' instead of url_prefix = '/wiki' to avoid user confusion and stale caches
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1276
diff changeset
623
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
624 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
625 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
626 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
627
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
628 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
629 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
630
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
631
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
632 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
633 """ 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
634 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
635 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
636 return self._meta_dict
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
637 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
638
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
639 # lazily load iwid(_full)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
640 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
641 def getter(self):
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
642 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
643 self.load_IWID()
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
644 return getattr(self, attr)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
645 return property(getter)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
646 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
647 iwid_full = make_iwid_property("_iwid_full")
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
648
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
649 def load_IWID(self):
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
650 """ 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
651 globally.
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
652 The IWID is available as cfg.iwid
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
653 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
654 This method is called by the property.
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
655 """
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
656
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
657 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
658 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
659 except KeyError:
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
660 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
661 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
662 self.meta_dict.sync()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
663
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
664 self._iwid = iwid
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
665 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
666 self._iwid_full = packLine([iwid, self.interwikiname])
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
667 else:
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
668 self._iwid_full = packLine([iwid])
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
669
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
670 def _config_check(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
671 """ Check namespace and warn about unknown names
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
672
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
673 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
674 modules, classes, _private or __magic__ names.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
675
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
676 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
677 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
678 """
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
679 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
680 if not name.startswith('_') and
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1799
diff changeset
681 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
682 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
683 if unknown:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
684 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
685 Unknown configuration options: %s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
686
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
687 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
688 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
689 """ % ', '.join(unknown)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
690 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
691
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
692 def _decode(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
693 """ Try to decode certain names, ignore unicode values
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
694
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
695 Try to decode str using utf-8. If the decode fail, raise FatalError.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
696
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
697 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
698 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
699 the file have a 'coding' line.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
700
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
701 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
702 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
703 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
704 config files.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
705 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
706 charset = 'utf-8'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
707 message = u'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
708 "%(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
709 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
710
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
711 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
712 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
713 '''
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
714
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
715 decode_names = (
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
716 '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
717 '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
718 '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
719 '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
720 '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
721 )
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
722
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
723 for name in decode_names:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
724 attr = getattr(self, name, None)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
725 if attr:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
726 # Try to decode strings
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
727 if isinstance(attr, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
728 try:
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
729 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
730 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
731 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
732 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
733 # 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
734 elif isinstance(attr, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
735 for i in xrange(len(attr)):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
736 item = attr[i]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
737 if isinstance(item, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
738 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
739 attr[i] = unicode(item, charset)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
740 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
741 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
742 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
743
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
744 def _check_directories(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
745 """ Make sure directories are accessible
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
746
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
747 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
748 execute.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
749 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
750 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
751 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
752 path = getattr(self, attr)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
753
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
754 # 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
755 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
756 continue
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
757
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
758 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
759 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
760 msg = '''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
761 %(attr)s "%(path)s" does not exists, or has incorrect ownership or
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
762 permissions.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
763
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
764 Make sure the directory and the subdirectory pages are owned by the web
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
765 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
766 and group.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
767
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
768 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
769 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
770 ''' % {'attr': attr, 'path': path, }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
771 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
772
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
773 def _loadPluginModule(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
774 """ import plugin module under configname.plugin
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
775
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
776 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
777 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
778 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
779
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
780 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
781 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
782 """
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1787
diff changeset
783 import imp
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
784
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
785 name = self.siteid + '.plugin'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
786 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
787 # 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
788 imp.acquire_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
789 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
790 # 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
791 if not name in sys.modules:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
792 # 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
793 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
794 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
795 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
796 # Load the module and set in sys.modules
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
797 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
798 sys.modules[self.siteid].plugin = module
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
799 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
800 # Make sure fp is closed properly
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
801 if fp:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
802 fp.close()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
803 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
804 imp.release_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
805 except ImportError, err:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
806 msg = '''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
807 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
808 %(err)s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
809
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
810 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
811 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
812 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
813 '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
814 '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
815 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
816 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
817
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
818 def _fillDicts(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
819 """ fill config dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
820
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
821 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
822 them from this base class.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
823 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
824 # user checkbox defaults
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
825 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
826 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
827 self.user_checkbox_defaults[key] = value
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
828
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
829 def __getitem__(self, item):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
830 """ 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
831 return getattr(self, item)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
832
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
833 # remove the gettext pseudo function
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
834 del _
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
835