annotate MoinMoin/config/multiconfig.py @ 3840:a7db3c488083

prevent CategoryTemplate being listed as a category (it is a Template, but matched also the category regex) (backport from 1.8)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 14 Jul 2008 03:04:34 +0200
parents 61ca04aca385
children 5c91b9e2b9fc 85cd05b8af42
rev   line source
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1 # -*- coding: iso-8859-1 -*-
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
2 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
3 MoinMoin - Multiple configuration handler and Configuration defaults class
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1868
diff changeset
5 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
3126
fac1b1e9ea95 multiconfig: better logging, tell path of config that is used
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3120
diff changeset
6 2005-2008 MoinMoin:ThomasWaldmann.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
7 @license: GNU GPL, see COPYING for details.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
8 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
9
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
10 import re
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
11 import os
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
12 import sys
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
13 import time
3107
c6e39279f83b refactor logging usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3097
diff changeset
14
3110
a48929a5036c logging: make it work correctly by doing logging configuration very early
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3107
diff changeset
15 from MoinMoin import log
a48929a5036c logging: make it work correctly by doing logging configuration very early
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3107
diff changeset
16 logging = log.getLogger(__name__)
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
17
1582
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1575
diff changeset
18 from MoinMoin import config, error, util, wikiutil
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
19 import MoinMoin.auth as authmodule
2307
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
20 import MoinMoin.events as events
2429
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
21 from MoinMoin.events import PageChangedEvent, PageRenamedEvent
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
22 from MoinMoin.events import PageDeletedEvent, PageCopiedEvent
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
23 from MoinMoin.events import PageRevertedEvent, FileAttachedEvent
2009
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
24 from MoinMoin import session
1096
33927b0256ce Changed marshalling format of the full IWID, load full IWID into the RemoteWiki object.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1080
diff changeset
25 from MoinMoin.packages import packLine
1276
7c29a18a7e26 more memory efficient and faster ACL processing, do not have before/after/default acl in ACL object, but only once in cfg
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1212
diff changeset
26 from MoinMoin.security import AccessControlList
2595
5e7b45489430 moved python2.3/2.4 compatibility code to MoinMoin.support.python_compatibility (thanks to Heinrich Wendel)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2491
diff changeset
27 from MoinMoin.support.python_compatibility import set
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
28
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
29 _url_re_cache = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
30 _farmconfig_mtime = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
31 _config_cache = {}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
32
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
33
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
34 def _importConfigModule(name):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
35 """ Import and return configuration module and its modification time
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
36
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
37 Handle all errors except ImportError, because missing file is not
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
38 always an error.
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
39
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
40 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
41 @rtype: tuple
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
42 @return: module, modification time
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
43 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
44 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
45 module = __import__(name, globals(), {})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
46 mtime = os.path.getmtime(module.__file__)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
47 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
48 raise
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
49 except IndentationError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
50 logging.exception('Your source code / config file is not correctly indented!')
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
51 msg = '''IndentationError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
52
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
53 The configuration files are python modules. Therefore, whitespace is
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
54 important. Make sure that you use only spaces, no tabs are allowed here!
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
55 You have to use four spaces at the beginning of the line mostly.
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
56 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
57 'err': err,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
58 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
59 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
60 except Exception, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
61 logging.exception('An exception happened.')
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
62 msg = '%s: %s' % (err.__class__.__name__, str(err))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
63 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
64 return module, mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
65
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
66
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
67 def _url_re_list():
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
68 """ Return url matching regular expression
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
69
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
70 Import wikis list from farmconfig on the first call and compile the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
71 regexes. Later then return the cached regex list.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
72
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
73 @rtype: list of tuples of (name, compiled re object)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
74 @return: url to wiki config name matching list
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
75 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
76 global _url_re_cache, _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
77 if _url_re_cache is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
78 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
79 farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig')
3626
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
80 except ImportError, err:
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
81 if 'farmconfig' in str(err):
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
82 # we failed importing farmconfig
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
83 logging.debug("could not import farmconfig, mapping all URLs to wikiconfig")
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
84 _farmconfig_mtime = 0
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
85 _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
86 else:
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
87 # maybe there was a failing import statement inside farmconfig
a4e5eed662e1 better handling of ImportErrors within farmconfig (before this fix, it just switched to wikiconfig in that case and confused users with errors about wikiconfig not found...)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3573
diff changeset
88 raise
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
89 else:
3129
d57fed1b0b43 multiconfig: also log which farmconfig we use
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3126
diff changeset
90 logging.info("using farm config: %s" % os.path.abspath(farmconfig.__file__))
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
91 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
92 cache = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
93 for name, regex in farmconfig.wikis:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
94 cache.append((name, re.compile(regex)))
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
95 _url_re_cache = cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
96 except AttributeError:
3126
fac1b1e9ea95 multiconfig: better logging, tell path of config that is used
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3120
diff changeset
97 logging.error("required 'wikis' list missing in farmconfig")
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
98 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
99 Missing required 'wikis' list in 'farmconfig.py'.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
100
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
101 If you run a single wiki you do not need farmconfig.py. Delete it and
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
102 use wikiconfig.py.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
103 """
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
104 raise error.ConfigurationError(msg)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
105 return _url_re_cache
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
106
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
107
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
108 def _makeConfig(name):
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
109 """ Create and return a config instance
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
110
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
111 Timestamp config with either module mtime or farmconfig mtime. This
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
112 mtime can be used later to invalidate older caches.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
113
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
114 @param name: module name
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
115 @rtype: DefaultConfig sub class instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
116 @return: new configuration instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
117 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
118 global _farmconfig_mtime
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
119 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
120 module, mtime = _importConfigModule(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
121 configClass = getattr(module, 'Config')
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
122 cfg = configClass(name)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
123 cfg.cfg_mtime = max(mtime, _farmconfig_mtime)
3129
d57fed1b0b43 multiconfig: also log which farmconfig we use
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3126
diff changeset
124 logging.info("using wiki config: %s" % os.path.abspath(module.__file__))
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
125 except ImportError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
126 logging.exception('Could not import.')
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
127 msg = '''ImportError: %(err)s
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
128
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
129 Check that the file is in the same directory as the server script. If
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
130 it is not, you must add the path of the directory where the file is
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
131 located to the python path in the server script. See the comments at
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
132 the top of the server script.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
133
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
134 Check that the configuration file name is either "wikiconfig.py" or the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
135 module name specified in the wikis list in farmconfig.py. Note that the
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
136 module name does not include the ".py" suffix.
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
137 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
138 'err': err,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
139 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
140 raise error.ConfigurationError(msg)
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
141 except AttributeError, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3149
diff changeset
142 logging.exception('An exception occured.')
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
143 msg = '''AttributeError: %(err)s
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
144
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
145 Could not find required "Config" class in "%(name)s.py".
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
146
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
147 This might happen if you are trying to use a pre 1.3 configuration file, or
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
148 made a syntax or spelling error.
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
149
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
150 Another reason for this could be a name clash. It is not possible to have
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
151 config names like e.g. stats.py - because that colides with MoinMoin/stats/ -
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
152 have a look into your MoinMoin code directory what other names are NOT
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
153 possible.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
154
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
155 Please check your configuration file. As an example for correct syntax,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
156 use the wikiconfig.py file from the distribution.
915
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
157 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
158 'name': name,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
159 'err': err,
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
160 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
161 raise error.ConfigurationError(msg)
2009
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
162
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
163 # postprocess configuration
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
164 # 'setuid' special auth method auth method can log out
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
165 cfg.auth_can_logout = ['setuid']
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
166 cfg.auth_login_inputs = []
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
167 found_names = []
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
168 for auth in cfg.auth:
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
169 if not auth.name:
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
170 raise error.ConfigurationError("Auth methods must have a name.")
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
171 if auth.name in found_names:
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
172 raise error.ConfigurationError("Auth method names must be unique.")
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
173 found_names.append(auth.name)
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
174 if auth.logout_possible and auth.name:
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
175 cfg.auth_can_logout.append(auth.name)
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
176 for input in auth.login_inputs:
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
177 if not input in cfg.auth_login_inputs:
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
178 cfg.auth_login_inputs.append(input)
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
179 cfg.auth_have_login = len(cfg.auth_login_inputs) > 0
1b14cc05a54a refactor authentication and split out session handling
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1984
diff changeset
180
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
181 return cfg
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
182
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
183
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
184 def _getConfigName(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
185 """ 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
186 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
187 match = regex.match(url)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
188 if match:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
189 return name
1575
45f876b6a109 raise NoConfigMatchedError
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1573
diff changeset
190 raise error.NoConfigMatchedError
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
191
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
192
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
193 def getConfig(url):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
194 """ 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
195
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
196 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
197 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
198 returned, using dict.setdefault.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
199
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
200 @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
201 @rtype: DefaultConfig subclass instance
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
202 @return: config object for specific wiki
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
203 """
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
204 cfgName = _getConfigName(url)
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
205 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
206 cfg = _config_cache[cfgName]
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
207 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
208 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
209 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
210 return cfg
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
211
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
212
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
213 # 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
214 # 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
215 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
216 return text
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
217
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
218
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
219 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
220 """ 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
221 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
222
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
223
3215
f12af017cfd1 fix DefaultConfig to be a new style class (it is using properties!)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3175
diff changeset
224 class DefaultConfig(object):
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
225 """ default config values
3485
aff01569df82 make sourcecode pep8 test happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3483
diff changeset
226
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
227 When adding new config attributes, PLEASE use a name with the TOPIC as prefix,
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
228 so it will sort naturally. E.g. use "actions_excluded", not "excluded_actions".
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
229
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
230 Also, please keep it (roughly) sorted (except if you have good reasons to group otherwise).
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
231 """
1597
bbe187af4fc0 integrated MMDE (build scripts need more work)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
232
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
233 DesktopEdition = False # True gives all local users special powers - ONLY use for MMDE style usage!
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
234
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
235 SecurityPolicy = None
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
236
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
237 acl_hierarchic = False # True to use hierarchical ACLs
729
8e8130a1f46b some cosmetic changes to config/multiconfig
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 718
diff changeset
238 # 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
239 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
240 acl_rights_before = u""
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
241 acl_rights_after = u""
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
242 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
243
3734
577d5eb99d6d add MyPages and CopyPage to actions_excluded because first doesn't work without special SecurityPolicy anyway and second has questionable behaviour
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3656
diff changeset
244 actions_excluded = ['xmlrpc', # we do not want wiki admins unknowingly offering xmlrpc service
577d5eb99d6d add MyPages and CopyPage to actions_excluded because first doesn't work without special SecurityPolicy anyway and second has questionable behaviour
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3656
diff changeset
245 'MyPages', # only works when used with a non-default SecurityPolicy (e.g. autoadmin)
577d5eb99d6d add MyPages and CopyPage to actions_excluded because first doesn't work without special SecurityPolicy anyway and second has questionable behaviour
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3656
diff changeset
246 'CopyPage', # has questionable behaviour regarding subpages a user can't read, but can copy
577d5eb99d6d add MyPages and CopyPage to actions_excluded because first doesn't work without special SecurityPolicy anyway and second has questionable behaviour
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3656
diff changeset
247 ]
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
248 allow_xslt = False
3115
cd6cfc715261 replace wikiwikiweb.de by moinmo.in, replace contact Juergen Hermann by Thomas Waldmann, cleanup wikiconfig (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3110
diff changeset
249 antispam_master_url = "http://master.moinmo.in/?action=xmlrpc2"
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
250
3656
6060395dcdf1 rename MoinLogin to MoinAuth for better consistency with other auth classes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3626
diff changeset
251 auth = [authmodule.MoinAuth()]
2020
1b0629547090 introduce cfg.trusted_auth_methods
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2009
diff changeset
252 # default to http and xmlrpc_applytoken to get old semantics
1b0629547090 introduce cfg.trusted_auth_methods
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2009
diff changeset
253 # xmlrpc_applytoken shall be removed once that code is changed
1b0629547090 introduce cfg.trusted_auth_methods
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2009
diff changeset
254 # to have proper session handling and use request.handle_auth()
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
255 auth_methods_trusted = ['http', 'xmlrpc_applytoken']
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
256
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
257 backup_compression = 'gz'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
258 backup_users = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
259 backup_include = []
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
260 backup_exclude = [
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
261 r"(.+\.py(c|o)$)",
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
262 r"%(cache_dir)s",
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
263 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
264 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
265 ]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
266 backup_storage_dir = '/tmp'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
267 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
268
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
269 bang_meta = True
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
270 caching_formats = ['text_html']
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
271 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
272
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
273 # 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
274
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
275 # 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
276 # chart_options = {'width = 720, 'height': 540}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
277 chart_options = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
278
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
279 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
280
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
281 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
282 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
283 cookie_lifetime = 12 # 12 hours from now
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
284
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
285 data_dir = './data/'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
286 data_underlay_dir = './underlay/'
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
287
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
288 date_fmt = '%Y-%m-%d'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
289 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
290
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
291 default_markup = 'wiki'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
292 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
293
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
294 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
295 editor_default = 'text' # which editor is called when nothing is specified
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
296 editor_force = False # force using the default editor
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
297 editor_ui = 'freechoice' # which editor links are shown on user interface
3095
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
298 editor_quickhelp = {
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
299 # editor markup hints quickhelp
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
300 # MUST be in wiki markup, even if the help is not for the wiki parser!
3264
cd28d66afe11 fix quickhelp, needs translation fixes!
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3240
diff changeset
301 'wiki': _(u"""\
2725
388204baf00f change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2595
diff changeset
302 Emphasis:: <<Verbatim('')>>''italics''<<Verbatim('')>>; <<Verbatim(''')>>'''bold'''<<Verbatim(''')>>; <<Verbatim(''''')>>'''''bold italics'''''<<Verbatim(''''')>>; <<Verbatim('')>>''mixed ''<<Verbatim(''')>>'''''bold'''<<Verbatim(''')>> and italics''<<Verbatim('')>>; <<Verbatim(----)>> horizontal rule.
3265
bd322703c85e no need to use Verbatim() macro with heading stuff in quickhelp
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3264
diff changeset
303 Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
304 Lists:: space and one of: * bullets; 1., a., A., i., I. numbered items; 1.#n start numbering at n; space alone indents.
2725
388204baf00f change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2595
diff changeset
305 Links:: <<Verbatim(JoinCapitalizedWords)>>; <<Verbatim([[target|linktext]])>>.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
306 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
307
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
308 (!) 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
309 """),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
310 'rst': _("""\
3095
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
311 {{{
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
312 Emphasis: *italic* **bold** ``monospace``
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
313
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
314 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
315 ========= --------- ~~~~~~~~~
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
316
3120
a7c1680aeaa0 PEP8 fixes, mostly whitespace
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3115
diff changeset
317 Horizontal rule: ----
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
318
3120
a7c1680aeaa0 PEP8 fixes, mostly whitespace
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3115
diff changeset
319 Links: TrailingUnderscore_ `multi word with backticks`_ external_
3095
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
320
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
321 .. _external: http://external-site.example.org/foo/
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
322
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
323 Lists: * bullets; 1., a. numbered items.
3095
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
324 }}}
3120
a7c1680aeaa0 PEP8 fixes, mostly whitespace
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3115
diff changeset
325 (!) For more help, see the
3095
cde8093bbb01 fixed the quickhelp shown when editing RST markup (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3092
diff changeset
326 [[http://docutils.sourceforge.net/docs/user/rst/quickref.html|reStructuredText Quick Reference]].
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
327 """),
3464
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
328 'creole': _(u"""\
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
329 Emphasis:: <<Verbatim(//)>>''italics''<<Verbatim(//)>>; <<Verbatim(**)>>'''bold'''<<Verbatim(**)>>; <<Verbatim(**//)>>'''''bold italics'''''<<Verbatim(//**)>>; <<Verbatim(//)>>''mixed ''<<Verbatim(**)>>'''''bold'''<<Verbatim(**)>> and italics''<<Verbatim(//)>>;
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
330 Horizontal Rule:: <<Verbatim(----)>>
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
331 Force Linebreak:: <<Verbatim(\\\\)>>
3465
badae7a72b0a config.multiconfig: removed verbatim for creoles quickhelp
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3464
diff changeset
332 Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
3464
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
333 Lists:: * bullets; ** sub-bullets; # numbered items; ## numbered sub items.
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
334 Links:: <<Verbatim([[target]])>>; <<Verbatim([[target|linktext]])>>.
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
335 Tables:: |= header text | cell text | more cell text |;
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
336
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
337 (!) For more help, see HelpOnEditing or HelpOnCreoleSyntax.
9478ddaf9924 config.multiconfig: added editor_quickhelp for creole markup
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3440
diff changeset
338 """),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
339 }
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
340 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
341 edit_ticketing = True
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
342 edit_rows = 20
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 hacks = {} # { 'feature1': value1, ... }
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
345 # Configuration for features still in development.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
346 # 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
347 # hacks = { 'feature': True, ...}
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
348 # and in the code use:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
349 # 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
350 # 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
351
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
352 history_count = (100, 200) # (default_revisions_shown, max_revisions_shown)
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
353
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
354 hosts_deny = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
355
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
356 html_head = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
357 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
358 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
359 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
360 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
361 html_pagetitle = None
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
362
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
363 interwikiname = None # our own interwikiname. choose wisely and never change!
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
364 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
365
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
366 language_default = 'en'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
367 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
368 # or user prefs
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
369
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
370 logo_string = None # can be either just some text or a piece of html shown as "logo"
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
371
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
372 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
373 # instead of just IPs
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
374 log_timing = False # log infos about timing of actions, good to analyze load conditions
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
375
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
376 mail_from = None # u'Juergen Wiki <noreply@jhwiki.org>'
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
377 mail_login = None # "user pwd" if you need to use SMTP AUTH when using your mail server
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
378 mail_smarthost = None # your SMTP mail server
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
379 mail_sendmail = None # "/usr/sbin/sendmail -t -i" to not use SMTP, but sendmail
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
380
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
381 mail_import_secret = "" # a shared secret also known to the mail importer xmlrpc script
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
382 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
383 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
384 mail_import_pagename_envelope = u"%s" # use u"+ %s/" to add "+ " and "/" automatically
2726
6cb75379c073 change ["free link"] to [[free link]] in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2725
diff changeset
385 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
386 mail_import_wiki_addrs = [] # the e-mail addresses for e-mails that should go into the wiki
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
387
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
388 # 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
389 # downloads such attachments, because the browser might execute e.g. Javascript contained
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
390 # in the HTML and steal your moin session cookie or do other nasty stuff)
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
391 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
392 '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
393 '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
394 '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
395 ]
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
396
1978
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
397 mimetypes_embed = [
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
398 'application/x-dvi',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
399 'application/postscript',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
400 'application/pdf',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
401 'application/ogg',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
402 'application/vnd.visio',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
403 'image/x-ms-bmp',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
404 'image/svg+xml',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
405 'image/tiff',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
406 'image/x-photoshop',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
407 'audio/mpeg',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
408 'audio/midi',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
409 'audio/x-wav',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
410 'video/fli',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
411 'video/mpeg',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
412 'video/quicktime',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
413 'video/x-msvideo',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
414 'chemical/x-pdb',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
415 'x-world/x-vrml',
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
416 ]
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
417
f6262ee86e0b EmbedObject: make mimetypes configurable
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1977
diff changeset
418
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
419 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
420 nonexist_qm = False
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
421
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
422 notification_bot_uri = None # uri of the jabber bot
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
423
3144
7aba52041f56 add OpenID provider code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3129
diff changeset
424 # OpenID server support
7aba52041f56 add OpenID provider code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3129
diff changeset
425 openid_server_enabled = False
7aba52041f56 add OpenID provider code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3129
diff changeset
426 openid_server_restricted_users_group = None
7aba52041f56 add OpenID provider code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3129
diff changeset
427 openid_server_enable_user = False
7aba52041f56 add OpenID provider code
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3129
diff changeset
428
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
429 page_credits = [
2227
c8ff348927db credits: slowly moving to moinmo.in
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2220
diff changeset
430 # Feel free to add other credits, but PLEASE do NOT change or remove
c8ff348927db credits: slowly moving to moinmo.in
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2220
diff changeset
431 # the following links - you help us by keeping them "as is":
3115
cd6cfc715261 replace wikiwikiweb.de by moinmo.in, replace contact Juergen Hermann by Thomas Waldmann, cleanup wikiconfig (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3110
diff changeset
432 '<a href="http://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin Powered</a>',
2227
c8ff348927db credits: slowly moving to moinmo.in
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2220
diff changeset
433 '<a href="http://moinmo.in/Python" title="MoinMoin is written in Python.">Python Powered</a>',
2193
cb913c851e91 credits: added title attr, added some comments, added GPL credit
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2191
diff changeset
434
cb913c851e91 credits: added title attr, added some comments, added GPL credit
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2191
diff changeset
435 # Optional credits:
2227
c8ff348927db credits: slowly moving to moinmo.in
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2220
diff changeset
436 # if you think it can be maybe misunderstood as applying to content or topic of your wiki,
2193
cb913c851e91 credits: added title attr, added some comments, added GPL credit
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2191
diff changeset
437 # feel free to remove this one:
2227
c8ff348927db credits: slowly moving to moinmo.in
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2220
diff changeset
438 '<a href="http://moinmo.in/GPL" title="MoinMoin is GPL licensed.">GPL licensed</a>',
c8ff348927db credits: slowly moving to moinmo.in
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2220
diff changeset
439
2193
cb913c851e91 credits: added title attr, added some comments, added GPL credit
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2191
diff changeset
440 # if you don't need/want to check the html output, feel free to remove this one:
cb913c851e91 credits: added title attr, added some comments, added GPL credit
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2191
diff changeset
441 '<a href="http://validator.w3.org/check?uri=referer" title="Click here to validate this page.">Valid HTML 4.01</a>',
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
442 ]
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
443
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
444 # you can put some pieces of html at specific places into the theme output:
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
445 page_footer1 = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
446 page_footer2 = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
447 page_header1 = ''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
448 page_header2 = ''
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
449
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
450 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
451 page_local_spelling_words = u'LocalSpellingWords'
3573
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
452
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
453 # the following regexes should match the complete name when used in free text
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
454 # the group 'all' shall match all, while the group 'key' shall match the key only
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
455 # e.g. CategoryFoo -> group 'all' == CategoryFoo, group 'key' == Foo
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
456 # moin's code will add ^ / $ at beginning / end when needed
3840
a7db3c488083 prevent CategoryTemplate being listed as a category (it is a Template, but matched also the category regex) (backport from 1.8)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3738
diff changeset
457 page_category_regex = ur'(?P<all>Category(?P<key>(?!Template)\S+))'
3573
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
458 page_dict_regex = ur'(?P<all>(?P<key>\S+)Dict)'
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
459 page_group_regex = ur'(?P<all>(?P<key>\S+)Group)'
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
460 page_template_regex = ur'(?P<all>(?P<key>\S+)Template)'
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
461
1513
4298764e3cef use booleans instead of 0/1 in configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1510
diff changeset
462 page_license_enabled = False
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
463 page_license_page = u'WikiLicense'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
464
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
465 # 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
466 # 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
467 # for email.
3541
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
468 page_iconbar = ["up", "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
469
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
470 # Standard buttons in the iconbar
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
471 page_icons_table = {
3541
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
472 # key pagekey, querystr dict, title, icon-key
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
473 'diff': ('page', {'action': 'diff'}, _("Diffs"), "diff"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
474 'info': ('page', {'action': 'info'}, _("Info"), "info"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
475 'edit': ('page', {'action': 'edit'}, _("Edit"), "edit"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
476 'unsubscribe': ('page', {'action': 'unsubscribe'}, _("UnSubscribe"), "unsubscribe"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
477 'subscribe': ('page', {'action': 'subscribe'}, _("Subscribe"), "subscribe"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
478 'raw': ('page', {'action': 'raw'}, _("Raw"), "raw"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
479 'xml': ('page', {'action': 'show', 'mimetype': 'text/xml'}, _("XML"), "xml"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
480 'print': ('page', {'action': 'print'}, _("Print"), "print"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
481 'view': ('page', {}, _("View"), "view"),
8ff53b14fc44 UP icon is back in the iconbar for themes not using clickable title navigation
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3490
diff changeset
482 'up': ('page_parent_page', {}, _("Up"), "up"),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
483 }
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
484
2431
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
485
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
486 def password_checker(username, password):
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
487 """ Check if a password is secure enough.
3315
e66f55d0076d security fix: remove cracklib support from password_checker (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3290
diff changeset
488 We use a built-in check to get rid of the worst passwords.
3322
dd519c814149 *sigh*. fix pep8 in multiconfig
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3315
diff changeset
489
3315
e66f55d0076d security fix: remove cracklib support from password_checker (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3290
diff changeset
490 We do NOT use cracklib / python-crack here any more because it is
e66f55d0076d security fix: remove cracklib support from password_checker (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3290
diff changeset
491 not thread-safe (we experienced segmentation faults when using it).
e66f55d0076d security fix: remove cracklib support from password_checker (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3290
diff changeset
492
2431
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
493 If you don't want to check passwords, use password_checker = None.
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
494
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
495 @return: None if there is no problem with the password,
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
496 some string with an error msg, if the password is problematic.
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
497 """
2491
41669a7a60ad Import set if it's unknown (python 2.3 compatibility)
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2447
diff changeset
498
41669a7a60ad Import set if it's unknown (python 2.3 compatibility)
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2447
diff changeset
499 try:
2431
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
500 # in any case, do a very simple built-in check to avoid the worst passwords
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
501 if len(password) < 6:
2443
b4c44e5be9e8 password_checker: more builtin checks, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2432
diff changeset
502 raise ValueError("Password too short.")
b4c44e5be9e8 password_checker: more builtin checks, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2432
diff changeset
503 if len(set(password)) < 4:
b4c44e5be9e8 password_checker: more builtin checks, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2432
diff changeset
504 raise ValueError("Password has not enough different characters.")
2431
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
505
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
506 username_lower = username.lower()
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
507 password_lower = password.lower()
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
508 if username in password or password in username or \
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
509 username_lower in password_lower or password_lower in username_lower:
2443
b4c44e5be9e8 password_checker: more builtin checks, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2432
diff changeset
510 raise ValueError("Password too easy (containment).")
2431
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
511
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
512 keyboards = (ur"`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./", # US kbd
2443
b4c44e5be9e8 password_checker: more builtin checks, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2432
diff changeset
513 ur"^1234567890ß´qwertzuiopü+asdfghjklöä#yxcvbnm,.-", # german kbd
2431
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
514 ) # add more keyboards!
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
515 for kbd in keyboards:
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
516 rev_kbd = kbd[::-1]
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
517 if password in kbd or password in rev_kbd or \
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
518 password_lower in kbd or password_lower in rev_kbd:
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
519 raise ValueError("Password too easy (kbd sequence)")
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
520 return None
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
521 except ValueError, err:
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
522 return str(err)
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
523
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
524 password_checker = staticmethod(password_checker)
58260d360f5c password_checker (simple builtin test, optionally using python-crack lib)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2426
diff changeset
525
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
526 quicklinks_default = [] # preload user quicklinks with this page list
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
527
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
528 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
529 rss_cache = 60 # suggested caching time for RecentChanges RSS, in seconds
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
530
3738
61ca04aca385 changed default of search_results_per_page to 25 (was: 10)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3734
diff changeset
531 search_results_per_page = 25
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
532
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
533 session_handler = session.DefaultSessionHandler()
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
534 session_id_handler = session.MoinCookieSessionIDHandler()
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
535
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
536 shared_intermap = None # can be string or list of strings (filenames)
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
537
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
538 show_hosts = True # show hostnames on RecentChanges / info/history action
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
539 show_interwiki = False # show our interwiki name (usually in front of the page name)
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
540 show_names = True # show editor names on RecentChanges / info/history action
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
541 show_section_numbers = 0 # enumerate sections (headlines) by default?
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
542 show_timings = False # show some timing stats (usually in the footer)
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
543 show_version = False # show moin version info / (C) (depends on theme)
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
544
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
545 sistersites = [
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
546 #('Self', 'http://localhost:8080/?action=sisterpages'),
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
547 #('EmacsWiki', 'http://www.emacswiki.org/cgi-bin/test?action=sisterpages'),
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
548 #('JspWiki', 'http://www.jspwiki.org/SisterSites.jsp'),
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
549 ] # list of (sistersitename, sisterpagelistfetchurl)
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
550
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
551 siteid = 'default'
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
552 sitename = u'Untitled Wiki' # Wiki identity
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
553
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
554 stylesheets = [] # list of tuples (media, csshref) to insert after theme css, before user css
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
555
2307
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
556 _subscribable_events = None # A list of event types that user can subscribe to
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
557 subscribed_pages_default = [] # preload user subscribed pages with this page list
2429
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
558 email_subscribed_events_default = [
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
559 PageChangedEvent.__name__,
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
560 PageRenamedEvent.__name__,
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
561 PageDeletedEvent.__name__,
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
562 PageCopiedEvent.__name__,
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
563 PageRevertedEvent.__name__,
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
564 FileAttachedEvent.__name__,
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
565 ]
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
566 jabber_subscribed_events_default = []
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
567
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
568 superuser = [] # list of unicode user names that have super powers :)
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
569
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
570 supplementation_page = False # use supplementation pages (show a link in the theme)?
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
571 supplementation_page_name = u'Discussion' # name of suppl. subpage
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
572 supplementation_page_template = u'DiscussionTemplate' # name of template used to create suppl. pages
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
573
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
574 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
575 # action: (count, dt)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
576 'all': (30, 30),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
577 'show': (30, 60),
3346
38cbacf3cbc4 slightly relaxed default surge protection settings (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3322
diff changeset
578 'recall': (10, 120),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
579 '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
580 'AttachFile': (90, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
581 'diff': (30, 60),
3346
38cbacf3cbc4 slightly relaxed default surge protection settings (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3322
diff changeset
582 'fullsearch': (10, 120),
38cbacf3cbc4 slightly relaxed default surge protection settings (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3322
diff changeset
583 'edit': (30, 300), # can be lowered after making preview different from edit
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
584 'rss_rc': (1, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
585 'default': (30, 60),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
586 }
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
587 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
588
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
589 textchas = None # a data structure with site-specific questions/answers, see HelpOnTextChas
2983
7b0aadb97d01 new antispam stuff: textchas (text CAPTCHAs), cleanup AttachFile handler (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2977
diff changeset
590 textchas_disabled_group = None # e.g. u'NoTextChasGroup' if you are a member of this group, you don't get textchas
7b0aadb97d01 new antispam stuff: textchas (text CAPTCHAs), cleanup AttachFile handler (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2977
diff changeset
591
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
592 theme_default = 'modern'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
593 theme_force = False
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
594
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
595 traceback_show = True # if True, tracebacks are displayed in the web browser
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
596 traceback_log_dir = None # if set to a directory path, tracebacks are written to files there
2205
cfc1595e53dc cfg.traceback_show (show tracebacks on the web) and cfg.traceback_log_dir (directory to dump tracebacks to - ported from 1.5 repo)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2193
diff changeset
597
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
598 trail_size = 5 # number of recently visited pagenames shown in the trail display
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
599 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
600
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
601 # 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
602 # and receive a FORBIDDEN for anything except viewing a page
3092
e3846a8e4bd5 remove 'java' from spider regex to fix saving twikidraw drawings (thanks to Ernestas Liubarskij)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3083
diff changeset
603 # list must not contain 'java' because of twikidraw wanting to save drawing uses this useragent
3012
ca0bf3aefa0f added more user agents to the spider list (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3004
diff changeset
604 ua_spiders = ('archiver|cfetch|charlotte|crawler|curl|gigabot|googlebot|heritrix|holmes|htdig|httrack|httpunit|'
3092
e3846a8e4bd5 remove 'java' from spider regex to fix saving twikidraw drawings (thanks to Ernestas Liubarskij)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3083
diff changeset
605 'intelix|jeeves|larbin|leech|libwww-perl|linkbot|linkmap|linkwalk|litefinder|mercator|'
3012
ca0bf3aefa0f added more user agents to the spider list (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3004
diff changeset
606 'microsoft.url.control|mirror| mj12bot|msnbot|msrbot|neomo|nutbot|omniexplorer|puf|robot|scooter|seekbot|'
ca0bf3aefa0f added more user agents to the spider list (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3004
diff changeset
607 'sherlock|slurp|sitecheck|snoopy|spider|teleport|twiceler|voilabot|voyager|webreaper|wget|yeti')
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
608
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
609 unzip_single_file_size = 2.0 * 1000 ** 2
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
610 unzip_attachments_space = 200.0 * 1000 ** 2
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
611 unzip_attachments_count = 101 # 1 zip file + 100 files contained in it
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
612
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
613 url_mappings = {}
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
614
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
615 # 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
616 # 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
617 # 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
618 # 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
619 # 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
620 # 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
621 # 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
622 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
623
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
624 # 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
625 # 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
626 # 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
627 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
628 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
629 # 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
630
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
631 # 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
632 #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
633 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
634
2306
5cf429e40f18 allow disabling certain userprefs plugins from config
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
635 # allow disabling certain userpreferences plugins
3482
b0a794176dc4 sorted builtin default config, added more comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3476
diff changeset
636 userprefs_disabled = []
2306
5cf429e40f18 allow disabling certain userprefs plugins from config
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2286
diff changeset
637
3483
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
638 user_autocreate = False # do we auto-create user profiles
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
639 user_email_unique = True # do we check whether a user's email is unique?
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
640 user_jid_unique = True # do we check whether a user's email is unique?
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
641
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
642 user_homewiki = 'Self' # interwiki name for where user homepages are located
0392c7258982 builtin default config: improve sorting
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3482
diff changeset
643
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
644 user_checkbox_fields = [
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
645 ('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
646 ('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
647 ('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
648 ('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
649 ('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
650 ('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
651 ('show_toolbar', lambda _: _('Show icon toolbar')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
652 ('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
653 ('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
654 ('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
655 ('remember_me', lambda _: _('Remember login information')),
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
656
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
657 ('disabled', lambda _: _('Disable this account forever')),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
658 # 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
659 # 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
660 # 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
661 ]
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
662
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
663 user_checkbox_defaults = {'mailto_author': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
664 'edit_on_doubleclick': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
665 'remember_last_visit': 0,
1977
abcbc20e8f8f raise unzip_attachments_count to 101, some other minor changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1959
diff changeset
666 'show_comments': 0,
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
667 'show_nonexist_qm': nonexist_qm,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
668 'show_page_trail': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
669 'show_toolbar': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
670 'show_topbottom': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
671 'show_fancy_diff': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
672 'wikiname_add_spaces': 0,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
673 'remember_me': 1,
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
674 }
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
675
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
676 # don't let the user change those
2429
0cd1152b8da5 default to email notification of all events to ease migration from old scheme
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2426
diff changeset
677 # user_checkbox_disable = ['disabled']
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
678 user_checkbox_disable = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
679
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
680 # remove those checkboxes:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
681 #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
682 # '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
683 user_checkbox_remove = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
684
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
685 user_form_fields = [
3050
f0250b5a6982 fix small i18n issues (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3012
diff changeset
686 ('name', _('Name'), "text", "36", _("(Use FirstnameLastname)")),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
687 ('aliasname', _('Alias-Name'), "text", "36", ''),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
688 ('email', _('Email'), "text", "36", ''),
2072
d347a0303be1 Add JID field and a button to send account details with Jabber to user preferences.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2021
diff changeset
689 ('jid', _('Jabber ID'), "text", "36", ''),
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
690 ('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
691 ('edit_rows', _('Editor size'), "text", "3", ''),
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
692 ]
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
693
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
694 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
695 'name': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
696 'aliasname': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
697 'password': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
698 'password2': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
699 'email': '',
2072
d347a0303be1 Add JID field and a button to send account details with Jabber to user preferences.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2021
diff changeset
700 'jid': '',
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
701 'css_url': '',
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
702 'edit_rows': "20",
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
703 }
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
704
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
705 # 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
706 #user_form_disable = ['name', 'aliasname', 'email',]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
707 user_form_disable = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
708
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
709 # remove those completely:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
710 #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
711 user_form_remove = []
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
712
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
713 # attributes we do NOT save to the userpref file
2020
1b0629547090 introduce cfg.trusted_auth_methods
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2009
diff changeset
714 user_transient_fields = ['id', 'valid', 'may', 'auth_username', '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
715
2989
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
716 xapian_search = False
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
717 xapian_index_dir = None
3440
41ad5058952b disabled xapian_stemming by default, added some comments to problematic code enabled by it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3346
diff changeset
718 xapian_stemming = False
2989
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
719 xapian_index_history = False
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
720
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
721 def __init__(self, siteid):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
722 """ Init Config instance """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
723 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
724 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
725
1624
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
726 from MoinMoin.Page import ItemCache
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
727 self.cache.meta = ItemCache('meta')
0b0b94e1680f cache pagelist using new cache mechanism
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1620
diff changeset
728 self.cache.pagelists = ItemCache('pagelists')
1620
a86f20280204 implement and use ItemMetaDataCache
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1615
diff changeset
729
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
730 if self.config_check_enabled:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
731 self._config_check()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
732
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
733 # 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
734 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
735 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
736 self.data_dir = data_dir
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
737 for dirname in ('user', 'cache', 'plugin'):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
738 name = dirname + '_dir'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
739 if not getattr(self, name, None):
1929
aa6aa944246b introduce per-user and per-session secrets that are used for the cookie
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1920
diff changeset
740 setattr(self, name, os.path.abspath(os.path.join(data_dir, dirname)))
855
481c72d4a181 support for common indices directory cfg.xapian_index_dir
Franz Pletz <fpletz AT franz-pletz DOT org>
parents: 838
diff changeset
741
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
742 # 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
743 self._decode()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
744
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
745 # 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
746 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
747 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
748 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
749 self.cache.page_template_regex = re.compile(self.page_template_regex, re.UNICODE)
3573
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
750
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
751 # the ..._regexact versions only match if nothing is left (exact match)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
752 self.cache.page_category_regexact = re.compile(u'^%s$' % self.page_category_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
753 self.cache.page_dict_regexact = re.compile(u'^%s$' % self.page_dict_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
754 self.cache.page_group_regexact = re.compile(u'^%s$' % self.page_group_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
755 self.cache.page_template_regexact = re.compile(u'^%s$' % self.page_template_regex, re.UNICODE)
124d0ef138aa change page_*_regex processing, see docs/CHANGES (fixes Xapian category search for non-english)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3541
diff changeset
756
1557
60067807cf9a Allow empty strings for ua_spiders.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1555
diff changeset
757 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
758
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
759 self._check_directories()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
760
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
761 if not isinstance(self.superuser, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
762 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
763 (e.g. ['Sample User', 'AnotherUser']).
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
764 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
765 raise error.ConfigurationError(msg)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
766
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
767 self._loadPluginModule()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
768
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
769 # Preparse user dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
770 self._fillDicts()
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
771
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
772 # Normalize values
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
773 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
774
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
775 # 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
776 if self.logo_string is None:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
777 self.logo_string = self.sitename
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
778
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
779 # Check for needed modules
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
780
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
781 # 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
782 # 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
783 # 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
784 # current code.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
785 if self.chart_options:
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 import gdchart
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
788 except ImportError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
789 self.chart_options = None
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
790
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
791 # post process
2430
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
792
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
793 # internal dict for plugin `modules' lists
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
794 self._site_plugin_lists = {}
c7bb078d3318 commit b8b87daf7cc4 broke farms because one dict was shared, fix it
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 2429
diff changeset
795
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
796 # 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
797 # 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
798 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
799 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
800
2989
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
801 # check if python-xapian is installed
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
802 if self.xapian_search:
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
803 try:
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
804 import xapian
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
805 except ImportError, err:
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
806 self.xapian_search = False
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
807 logging.error("xapian_search was auto-disabled because python-xapian is not installed [%s]." % str(err))
c678e73b7730 auto-disable xapian_search when xapian fails to import (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2985
diff changeset
808
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
809 # 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
810 self.xapian_searchers = []
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
811
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
812 # 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
813 self.mail_enabled = (self.mail_smarthost is not None or self.mail_sendmail is not None) and self.mail_from
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
814
2072
d347a0303be1 Add JID field and a button to send account details with Jabber to user preferences.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2021
diff changeset
815 # check if jabber bot is available and set flag:
2160
7c8ee12f8c1d Fix an error with missing bot_host attribute. Use more descriptive names.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2152
diff changeset
816 self.jabber_enabled = self.notification_bot_uri is not None
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
817
2147
b01a6ef1be4c Get rid of the global xmlrpc Server object. Instantiate one in config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2091
diff changeset
818 # if we are to use the jabber bot, instantiate a server object for future use
b01a6ef1be4c Get rid of the global xmlrpc Server object. Instantiate one in config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2091
diff changeset
819 if self.jabber_enabled:
2336
10be78f1fa97 Merge main.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2331 2286
diff changeset
820
2331
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
821 errmsg = "You must set a (long) secret string to send notifications!"
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
822 try:
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
823 if not self.secret:
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
824 raise error.ConfigurationError(errmsg)
493565b060ff Raise exception if notifications are enabled but no secret is set.
Karol Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2324
diff changeset
825 except AttributeError, err:
3175
2a3a6cb34e45 pylint findings: fix some harmless stuff
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3157
diff changeset
826 raise error.ConfigurationError(errmsg)
2336
10be78f1fa97 Merge main.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2331 2286
diff changeset
827
2147
b01a6ef1be4c Get rid of the global xmlrpc Server object. Instantiate one in config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2091
diff changeset
828 from xmlrpclib import Server
2160
7c8ee12f8c1d Fix an error with missing bot_host attribute. Use more descriptive names.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2152
diff changeset
829 self.notification_server = Server(self.notification_bot_uri, )
1080
f8ba3b0ca9f4 Use the meta dict instead of a distinct file for the IWID.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1053
diff changeset
830
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
831 # 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
832 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
833
1552
f9639ed07af2 using request.cfg.cache more
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1549
diff changeset
834 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
835 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
836 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
837
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
838 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
839 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
840
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
841 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
842 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
843 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
844
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
845 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
846 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
847
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
848
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
849 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
850 """ 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
851 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
852 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
853 return self._meta_dict
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
854 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
855
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
856 # lazily load iwid(_full)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
857 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
858 def getter(self):
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
859 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
860 self.load_IWID()
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
861 return getattr(self, attr)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
862 return property(getter)
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
863 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
864 iwid_full = make_iwid_property("_iwid_full")
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
865
2307
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
866 # lazily load a list of events a user can subscribe to
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
867 def make_subscribable_events_prop():
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
868 def getter(self):
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
869 if getattr(self, "_subscribable_events", None) is None:
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
870 self._subscribable_events = events.get_subscribable_events()
fe37834deb3d Move a list of event handlers and subscribable events to config.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2227
diff changeset
871 return getattr(self, "_subscribable_events")
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
872
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
873 def setter(self, new_events):
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
874 self._subscribable_events = new_events
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
875
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
876 return property(getter, setter)
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
877 subscribable_events = make_subscribable_events_prop()
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
878
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
879 # lazily create a list of event handlers
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
880 def make_event_handlers_prop():
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
881 def getter(self):
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
882 if getattr(self, "_event_handlers", None) is None:
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
883 self._event_handlers = events.get_handlers(self)
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
884 return getattr(self, "_event_handlers")
3240
e8fcaf99434f config.multiconfig: PEP8 fixed
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3223
diff changeset
885
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
886 def setter(self, new_handlers):
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
887 self._event_handlers = new_handlers
3240
e8fcaf99434f config.multiconfig: PEP8 fixed
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3223
diff changeset
888
3223
6ca25943fd1a Fixed PageEditor tests; also fixed the subscribable_events property
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 3215
diff changeset
889 return property(getter, setter)
2643
ec855cfb2561 Load event handler lazily.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2595
diff changeset
890 event_handlers = make_event_handlers_prop()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
891
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
892 def load_IWID(self):
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
893 """ 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
894 globally.
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
895 The IWID is available as cfg.iwid
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
896 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
897 This method is called by the property.
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
898 """
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
899 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
900 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
901 except KeyError:
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
902 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
903 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
904 self.meta_dict.sync()
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
905
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
906 self._iwid = iwid
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
907 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
908 self._iwid_full = packLine([iwid, self.interwikiname])
1053
6632f9919a89 Implemented IWID system.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1011
diff changeset
909 else:
1118
156d160b1dd9 Load the IWID and the meta dict lazily.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1111
diff changeset
910 self._iwid_full = packLine([iwid])
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
911
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
912 def _config_check(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
913 """ Check namespace and warn about unknown names
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
914
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
915 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
916 modules, classes, _private or __magic__ names.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
917
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
918 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
919 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
920 """
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
921 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
922 if not name.startswith('_') and
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1799
diff changeset
923 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
924 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
925 if unknown:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
926 msg = """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
927 Unknown configuration options: %s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
928
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
929 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
930 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
931 """ % ', '.join(unknown)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
932 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
933
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
934 def _decode(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
935 """ Try to decode certain names, ignore unicode values
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
936
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
937 Try to decode str using utf-8. If the decode fail, raise FatalError.
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
938
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
939 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
940 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
941 the file have a 'coding' line.
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
942
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
943 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
944 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
945 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
946 config files.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
947 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
948 charset = 'utf-8'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
949 message = u'''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
950 "%(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
951 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
952
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
953 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
954 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
955 '''
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
956
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
957 decode_names = (
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
958 '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
959 '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
960 '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
961 '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
962 '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
963 )
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
964
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
965 for name in decode_names:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
966 attr = getattr(self, name, None)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
967 if attr:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
968 # Try to decode strings
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
969 if isinstance(attr, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
970 try:
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
971 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
972 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
973 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
974 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
975 # 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
976 elif isinstance(attr, list):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
977 for i in xrange(len(attr)):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
978 item = attr[i]
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
979 if isinstance(item, str):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
980 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
981 attr[i] = unicode(item, charset)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
982 except UnicodeError:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
983 raise error.ConfigurationError(message %
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
984 {'name': name})
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
985
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
986 def _check_directories(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
987 """ Make sure directories are accessible
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
988
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
989 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
990 execute.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
991 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
992 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
993 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
994 path = getattr(self, attr)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
995
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
996 # 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
997 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
998 continue
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
999
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1000 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
1001 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
1002 msg = '''
3490
af3460a4cb79 fix some typos in messages / comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3485
diff changeset
1003 %(attr)s "%(path)s" does not exist, or has incorrect ownership or
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1004 permissions.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1005
3490
af3460a4cb79 fix some typos in messages / comments
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3485
diff changeset
1006 Make sure the directory and the subdirectory "pages" are owned by the web
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1007 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
1008 and group.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1009
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1010 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
1011 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
1012 ''' % {'attr': attr, 'path': path, }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1013 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1014
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1015 def _loadPluginModule(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1016 """ import plugin module under configname.plugin
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1017
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1018 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
1019 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
1020 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
1021
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1022 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
1023 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
1024 """
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1787
diff changeset
1025 import imp
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1026
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1027 name = self.siteid + '.plugin'
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1028 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1029 # 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
1030 imp.acquire_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1031 try:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1032 # 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
1033 if not name in sys.modules:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1034 # 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
1035 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
1036 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
1037 try:
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
1038 # Load the module and set in sys.modules
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1039 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
1040 sys.modules[self.siteid].plugin = module
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1041 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1042 # Make sure fp is closed properly
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1043 if fp:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1044 fp.close()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1045 finally:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1046 imp.release_lock()
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1047 except ImportError, err:
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1048 msg = '''
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1049 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
1050 %(err)s.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1051
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1052 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
1053 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
1054 ''' % {
f3f38ecf4cf3 add hint to configuration error msg about potential name clash reason
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 877
diff changeset
1055 '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
1056 '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
1057 }
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1058 raise error.ConfigurationError(msg)
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1059
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1060 def _fillDicts(self):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1061 """ fill config dicts
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1062
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1063 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
1064 them from this base class.
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1065 """
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1066 # user checkbox defaults
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1067 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
1068 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
1069 self.user_checkbox_defaults[key] = value
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1070
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1071 def __getitem__(self, item):
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1072 """ 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
1073 return getattr(self, item)
931
141083b64fb1 whitespace and minor style changes only
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 928
diff changeset
1074
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2227
diff changeset
1075 # remove the gettext pseudo function
706
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1076 del _
fce105e8b3df Fixed line endings in multiconfig.py
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 705
diff changeset
1077