annotate MoinMoin/multiconfig.py @ 528:92faed4fbd76

updated i18n, fix orig. text typo imported from: moin--main--1.5--patch-532
author Thomas Waldmann <tw@waldmann-edv.de>
date Fri, 07 Apr 2006 17:35:19 +0000
parents d0dba03190b6
children 8cfff674409f 4840926790f5
rev   line source
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
2 """
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
3 MoinMoin - Multiple configuration handler and Configuration defaults class
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
5 @copyright: 2000-2004 by Jürgen Hermann <jh@web.de>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
7 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
8
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
9 import re, os, sys
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10 from MoinMoin import error
6
2a982e08aee5 Fixed star import.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
11 import MoinMoin.auth as authmodule
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
12
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
13 _url_re_cache = None
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
14 _farmconfig_mtime = None
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
15 _config_cache = {}
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
16
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
17
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
18 def _importConfigModule(name):
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
19 """ Import and return configuration module and its modification time
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
20
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
21 Handle all errors except ImportError, because missing file is not
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
22 always an error.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
23
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
24 @param name: module name
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
25 @rtype: tuple
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
26 @return: module, modification time
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
27 """
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
28 try:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
29 module = __import__(name, globals(), {})
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
30 mtime = os.path.getmtime(module.__file__)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
31 except ImportError:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
32 raise
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
33 except IndentationError, err:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
34 msg = 'IndentationError: %s\n' % str(err) + '''
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
35
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
36 The configuration files are python modules. Therefore, whitespace is
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
37 important. Make sure that you use only spaces, no tabs are allowed here!
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
38 You have to use four spaces at the beginning of the line mostly.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
39 '''
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
40 raise error.ConfigurationError(msg)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
41 except Exception, err:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
42 msg = '%s: %s' % (err.__class__.__name__, str(err))
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
43 raise error.ConfigurationError(msg)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
44 return module, mtime
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
45
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
46
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
47 def _url_re_list():
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
48 """ Return url matching regular expression
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
49
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
50 Import wikis list from farmconfig on the first call and compile the
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
51 regexes. Later then return the cached regex list.
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
52
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
53 @rtype: list of tuples of (name, compiled re object)
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
54 @return: url to wiki config name matching list
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
55 """
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
56 global _url_re_cache, _farmconfig_mtime
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
57 if _url_re_cache is None:
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
58 try:
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
59 farmconfig, _farmconfig_mtime = _importConfigModule('farmconfig')
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
60 except ImportError:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
61 # Default to wikiconfig for all urls.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
62 _farmconfig_mtime = 0
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
63 _url_re_cache = [('wikiconfig', re.compile(r'.')), ] # matches everything
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
64 else:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
65 try:
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
66 cache = []
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
67 for name, regex in farmconfig.wikis:
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
68 cache.append((name, re.compile(regex)))
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
69 _url_re_cache = cache
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
70 except AttributeError:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
71 msg = """
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
72 Missing required 'wikis' list in 'farmconfig.py'.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
73
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
74 If you run a single wiki you do not need farmconfig.py. Delete it and
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
75 use wikiconfig.py.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
76 """
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
77 raise error.ConfigurationError(msg)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
78 return _url_re_cache
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
79
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
80
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
81 def _makeConfig(name):
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
82 """ Create and return a config instance
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
83
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
84 Timestamp config with either module mtime or farmconfig mtime. This
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
85 mtime can be used later to invalidate older caches.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
86
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
87 @param name: module name
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
88 @rtype: DefaultConfig sub class instance
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
89 @return: new configuration instance
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
90 """
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
91 global _farmconfig_mtime
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
92 try:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
93 module, mtime = _importConfigModule(name)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
94 configClass = getattr(module, 'Config')
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
95 cfg = configClass(name)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
96 cfg.cfg_mtime = max(mtime, _farmconfig_mtime)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
97 except ImportError, err:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
98 msg = 'ImportError: %s\n' % str(err) + '''
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
99
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
100 Check that the file is in the same directory as the server script. If
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
101 it is not, you must add the path of the directory where the file is
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
102 located to the python path in the server script. See the comments at
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
103 the top of the server script.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
104
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
105 Check that the configuration file name is either "wikiconfig.py" or the
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
106 module name specified in the wikis list in farmconfig.py. Note that the
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
107 module name does not include the ".py" suffix.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
108 '''
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
109 raise error.ConfigurationError(msg)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
110 except AttributeError:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
111 msg = '''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
112 Could not find required "Config" class in "%(name)s.py". This might
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
113 happen if you are trying to use a pre 1.3 configuration file, or made a
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
114 syntax or spelling error.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
115
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
116 Please check your configuration file. As an example for correct syntax,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
117 use the wikiconfig.py file from the distribution.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
118 ''' % {'name': name}
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
119 raise error.ConfigurationError(msg)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
120 return cfg
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
121
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
122
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
123 def _getConfigName(url):
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
124 """ Return config name for url or raise """
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
125 for name, regex in _url_re_list():
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
126 match = regex.match(url)
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
127 if match:
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
128 return name
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
129 # nothing matched
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
130 msg = '''
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
131 Could not find a match for url: "%(url)s".
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
132
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
133 Check your URL regular expressions in the "wikis" list in
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
134 "farmconfig.py".
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
135 ''' % {'url': url}
443
f2f1db293930 fix farmconfig.wikis processing for big farms (>=50 wikis) by not using a big RE for it
Thomas Waldmann <tw@waldmann-edv.de>
parents: 441
diff changeset
136 raise error.ConfigurationError(msg)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
137
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
138
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
139 def getConfig(url):
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
140 """ Return cached config instance for url or create new one
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
141
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
142 If called by many threads in the same time multiple config
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
143 instances might be created. The first created item will be
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
144 returned, using dict.setdefault.
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
145
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
146 @param url: the url from request, possibly matching specific wiki
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
147 @rtype: DefaultConfig subclass instance
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
148 @return: config object for specific wiki
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
149 """
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
150 configName = _getConfigName(url)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
151 try:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
152 config = _config_cache[configName]
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
153 except KeyError:
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
154 config = _makeConfig(configName)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
155 config = _config_cache.setdefault(configName, config)
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
156 return config
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
157
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
158
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
159 # This is a way to mark some text for the gettext tools so that they don't
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
160 # get orphaned. See http://www.python.org/doc/current/lib/node278.html.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
161 def _(text): return text
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
162
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
163
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
164 class DefaultConfig:
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
165 """ default config values """
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
166
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
167 # All acl_right lines must use unicode!
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
168 acl_rights_default = u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write"
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
169 acl_rights_before = u""
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
170 acl_rights_after = u""
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
171 acl_rights_valid = ['read', 'write', 'delete', 'revert', 'admin']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
172
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
173 actions_excluded = [] # ['DeletePage', 'AttachFile', 'RenamePage']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
174 allow_xslt = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
175 attachments = None # {'dir': path, 'url': url-prefix}
6
2a982e08aee5 Fixed star import.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
176 auth = [authmodule.moin_cookie]
65
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
177
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents: 65
diff changeset
178 backup_compression = 'gz'
55
2932ba63d998 make WikiBackup action configurable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 49
diff changeset
179 backup_users = []
2932ba63d998 make WikiBackup action configurable
Thomas Waldmann <tw@waldmann-edv.de>
parents: 49
diff changeset
180 backup_include = []
65
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
181 backup_exclude = [
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
182 r"(.+\.py(c|o)$)",
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
183 r"%(cache_dir)s",
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
184 r"%(/)spages%(/)s.+%(/)scache%(/)s[^%(/)s]+$" % {'/': os.sep},
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
185 r"%(/)s(edit-lock|event-log|\.DS_Store)$" % {'/': os.sep},
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
186 ]
99
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents: 65
diff changeset
187 backup_storage_dir = '/tmp'
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents: 65
diff changeset
188 backup_restore_target_dir = '/tmp'
ce657f0e577b implement restore backup subaction, with a already local backup file
Thomas Waldmann <tw@waldmann-edv.de>
parents: 65
diff changeset
189
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
190 bang_meta = 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
191 caching_formats = ['text_html']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
192 changed_time_fmt = '%H:%M'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
193 # chars_{upper,lower,digits,spaces} see MoinMoin/util/chartypes.py
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
194 # if you have gdchart, add something like
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
195 # chart_options = {'width = 720, 'height': 540}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
196 chart_options = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
197 config_check_enabled = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
198 cookie_domain = None # use '.domain.tld" for a farm with hosts in that domain
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
199 cookie_path = None # use '/wikifarm" for a farm with pathes below that path
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
200 cookie_lifetime = 12 # 12 hours from now
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
201 data_dir = './data/'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
202 data_underlay_dir = './underlay/'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
203 date_fmt = '%Y-%m-%d'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
204 datetime_fmt = '%Y-%m-%d %H:%M:%S'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
205 default_markup = 'wiki'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
206 docbook_html_dir = r"/usr/share/xml/docbook/stylesheet/nwalsh/html/" # correct for debian sarge
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
207 editor_default = 'text' # which editor is called when nothing is specified
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
208 editor_ui = 'freechoice' # which editor links are shown on user interface
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
209 editor_force = False
526
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
210 editor_quickhelp = { # editor markup hints quickhelp
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
211 'wiki': _("""\
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
212 Emphasis:: [[Verbatim('')]]''italics''[[Verbatim('')]]; [[Verbatim(''')]]'''bold'''[[Verbatim(''')]]; [[Verbatim(''''')]]'''''bold italics'''''[[Verbatim(''''')]]; [[Verbatim('')]]''mixed ''[[Verbatim(''')]]'''''bold'''[[Verbatim(''')]] and italics''[[Verbatim('')]]; [[Verbatim(----)]] horizontal rule.
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
213 Headings:: [[Verbatim(=)]] Title 1 [[Verbatim(=)]]; [[Verbatim(==)]] Title 2 [[Verbatim(==)]]; [[Verbatim(===)]] Title 3 [[Verbatim(===)]]; [[Verbatim(====)]] Title 4 [[Verbatim(====)]]; [[Verbatim(=====)]] Title 5 [[Verbatim(=====)]].
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
214 Lists:: space and one of: * bullets; 1., a., A., i., I. numbered items; 1.#n start numbering at n; space alone indents.
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
215 Links:: [[Verbatim(JoinCapitalizedWords)]]; [[Verbatim(["brackets and double quotes"])]]; url; [url]; [url label].
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
216 Tables:: || cell text |||| cell text spanning 2 columns ||; no trailing white space allowed after tables or titles.
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
217
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
218 (!) For more help, see HelpOnEditing or SyntaxReference.
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
219 """),
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
220 'rst': _("""\
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
221 Emphasis: <i>*italic*</i> <b>**bold**</b> ``monospace``<br/>
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
222 <br/><pre>
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
223 Headings: Heading 1 Heading 2 Heading 3
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
224 ========= --------- ~~~~~~~~~
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
225
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
226 Horizontal rule: ----
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
227 Links: TrailingUnderscore_ `multi word with backticks`_ external_
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
228
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
229 .. _external: http://external-site.net/foo/
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
230
528
92faed4fbd76 updated i18n, fix orig. text typo
Thomas Waldmann <tw@waldmann-edv.de>
parents: 526
diff changeset
231 Lists: * bullets; 1., a. numbered items.
526
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
232 </pre>
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
233 <br/>
528
92faed4fbd76 updated i18n, fix orig. text typo
Thomas Waldmann <tw@waldmann-edv.de>
parents: 526
diff changeset
234 (!) For more help, see the
526
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
235 <a href="http://docutils.sourceforge.net/docs/user/rst/quickref.html">
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
236 reStructuredText Quick Reference
528
92faed4fbd76 updated i18n, fix orig. text typo
Thomas Waldmann <tw@waldmann-edv.de>
parents: 526
diff changeset
237 </a>.
526
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
238 """),
d0dba03190b6 cfg.editor_quickhelp to make quickhelp work correctly and configurably for default markup at least
Thomas Waldmann <tw@waldmann-edv.de>
parents: 449
diff changeset
239 }
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
240 edit_locking = 'warn 10' # None, 'warn <timeout mins>', 'lock <timeout mins>'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
241 edit_rows = 20
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
242
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
243 hacks = {} # { 'feature1': value1, ... }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
244 # Configuration for features still in development.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
245 # For boolean stuff just use config like this:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
246 # hacks = { 'feature': True, ...}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
247 # and in the code use:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
248 # if cfg.hacks.get('feature', False): <doit>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
249 # A non-existing hack key should ever mean False, None, "", [] or {}!
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
250
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
251 hosts_deny = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
252 html_head = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
253 html_head_queries = '''<meta name="robots" content="noindex,nofollow">\n'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
254 html_head_posts = '''<meta name="robots" content="noindex,nofollow">\n'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
255 html_head_index = '''<meta name="robots" content="index,follow">\n'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
256 html_head_normal = '''<meta name="robots" content="index,nofollow">\n'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
257 html_pagetitle = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
258
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
259 interwiki_preferred = [] # list of wiki names to show at top of interwiki list
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
260
131
1738cbba372c new cfg settings: language_ignore_browser and language_default (was: default_lang)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 117
diff changeset
261 language_default = 'en'
1738cbba372c new cfg settings: language_ignore_browser and language_default (was: default_lang)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 117
diff changeset
262 language_ignore_browser = False # ignore browser settings, use language_default
1738cbba372c new cfg settings: language_ignore_browser and language_default (was: default_lang)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 117
diff changeset
263 # or user prefs
1738cbba372c new cfg settings: language_ignore_browser and language_default (was: default_lang)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 117
diff changeset
264
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
265 lupy_search = False # disabled until lupy is finished
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
266
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
267 mail_login = None # or "user pwd" if you need to use SMTP AUTH
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
268 mail_sendmail = None # "/usr/sbin/sendmail -t -i" to not use SMTP, but sendmail
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
269 mail_smarthost = None
63
d1333236adba backward compability with 1.3 mail_from configuration, update example configuration, add tests
Nir Soffer <nirs@freeshell.org>
parents: 55
diff changeset
270 mail_from = None # u'Jürgen Wiki <noreply@jhwiki.org>'
d1333236adba backward compability with 1.3 mail_from configuration, update example configuration, add tests
Nir Soffer <nirs@freeshell.org>
parents: 55
diff changeset
271
153
c4c7dc546c65 ThemeChange, excluding optional content heading rendering change
Thomas Waldmann <tw@waldmann-edv.de>
parents: 131
diff changeset
272 navi_bar = [u'RecentChanges', u'FindPage', u'HelpContents', ]
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
273 nonexist_qm = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
274
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
275 page_credits = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
276 '<a href="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a>',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
277 '<a href="http://www.python.org/">Python Powered</a>',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
278 '<a href="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a>',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
279 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
280 page_footer1 = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
281 page_footer2 = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
282
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
283 page_header1 = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
284 page_header2 = ''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
285
35
f0af060fb82b making people choose the right approach to page_front_page
Thomas Waldmann <tw@waldmann-edv.de>
parents: 18
diff changeset
286 page_front_page = u'HelpOnLanguages' # this will make people choose a sane config
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
287 page_local_spelling_words = u'LocalSpellingWords'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
288 page_category_regex = u'^Category[A-Z]'
38
9ab510c272c4 be a bit less restrictive on some pagename matching regexes
Thomas Waldmann <tw@waldmann-edv.de>
parents: 35
diff changeset
289 page_dict_regex = u'[a-z0-9]Dict$'
9ab510c272c4 be a bit less restrictive on some pagename matching regexes
Thomas Waldmann <tw@waldmann-edv.de>
parents: 35
diff changeset
290 page_group_regex = u'[a-z0-9]Group$'
9ab510c272c4 be a bit less restrictive on some pagename matching regexes
Thomas Waldmann <tw@waldmann-edv.de>
parents: 35
diff changeset
291 page_template_regex = u'[a-z0-9]Template$'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
292
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
293 page_license_enabled = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
294 page_license_page = u'WikiLicense'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
295
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
296 # These icons will show in this order in the iconbar, unless they
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
297 # are not relevant, e.g email icon when the wiki is not configured
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
298 # for email.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
299 page_iconbar = ["up", "edit", "view", "diff", "info", "subscribe", "raw", "print",]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
300
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
301 # Standard buttons in the iconbar
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
302 page_icons_table = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
303 # key last part of url, title, icon-key
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
304 'help': ("%(q_page_help_contents)s", "%(page_help_contents)s", "help"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
305 'find': ("%(q_page_find_page)s?value=%(q_page_name)s", "%(page_find_page)s", "find"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
306 'diff': ("%(q_page_name)s?action=diff", _("Diffs"), "diff"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
307 'info': ("%(q_page_name)s?action=info", _("Info"), "info"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
308 'edit': ("%(q_page_name)s?action=edit", _("Edit"), "edit"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
309 'unsubscribe': ("%(q_page_name)s?action=subscribe", _("UnSubscribe"), "unsubscribe"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
310 'subscribe': ("%(q_page_name)s?action=subscribe", _("Subscribe"), "subscribe"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
311 'raw': ("%(q_page_name)s?action=raw", _("Raw"), "raw"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
312 'xml': ("%(q_page_name)s?action=format&amp;mimetype=text/xml", _("XML"), "xml"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
313 'print': ("%(q_page_name)s?action=print", _("Print"), "print"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
314 'view': ("%(q_page_name)s", _("View"), "view"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
315 'up': ("%(q_page_parent_page)s", _("Up"), "up"),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
316 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
317 refresh = None # (minimum_delay, type), e.g.: (2, 'internal')
15
5a2a8201bb6f make moin friendlier to proxies, thanks to ASF
Thomas Waldmann <tw@waldmann-edv.de>
parents: 6
diff changeset
318 rss_cache = 60 # suggested caching time for RecentChanges RSS, in seconds
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
319 shared_intermap = None # can be string or list of strings (filenames)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
320 show_hosts = 1
211
f374d87dd925 change show_interwiki default to 0
Thomas Waldmann <tw@waldmann-edv.de>
parents: 161
diff changeset
321 show_interwiki = 0
297
fe57f191672e make login/logout showing configurable, update CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 265
diff changeset
322 show_login = 1
371
a6e61f5e1a69 Split show_hosts into show_hosts and show_names.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 346
diff changeset
323 show_names = True
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
324 show_section_numbers = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
325 show_timings = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
326 show_version = 0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
327 siteid = 'default'
221
b1d744e2fd29 cfg.stylesheets for admin configurable additional style sheets
Thomas Waldmann <tw@waldmann-edv.de>
parents: 213
diff changeset
328 stylesheets = [] # list of tuples (media, csshref) to insert after theme css, before user css
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
329 superuser = [] # list of unicode user names that have super powers :)
411
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
330
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
331 surge_action_limits = { # allow max. <count> <action> requests per <dt> secs
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
332 # action: (count, dt)
445
a71176d858be surge protection: specialcase AttachFile, fix no cache exists case
Thomas Waldmann <tw@waldmann-edv.de>
parents: 443
diff changeset
333 'all': (30, 30),
a71176d858be surge protection: specialcase AttachFile, fix no cache exists case
Thomas Waldmann <tw@waldmann-edv.de>
parents: 443
diff changeset
334 'show': (30, 60),
440
0f07dcad6614 reorderer 1. bot 2. surge protection, add sleep time for forbidden requests, add surge prot. value for recall action
Thomas Waldmann <tw@waldmann-edv.de>
parents: 439
diff changeset
335 'recall': (5, 60),
420
b4ff26eb2c43 adjusting some surge protection limits
Thomas Waldmann <tw@waldmann-edv.de>
parents: 413
diff changeset
336 'raw': (20, 40), # some people use this for css
445
a71176d858be surge protection: specialcase AttachFile, fix no cache exists case
Thomas Waldmann <tw@waldmann-edv.de>
parents: 443
diff changeset
337 'AttachFile': (90, 60),
420
b4ff26eb2c43 adjusting some surge protection limits
Thomas Waldmann <tw@waldmann-edv.de>
parents: 413
diff changeset
338 'diff': (30, 60),
411
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
339 'fullsearch': (5, 60),
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
340 'edit': (10, 120),
420
b4ff26eb2c43 adjusting some surge protection limits
Thomas Waldmann <tw@waldmann-edv.de>
parents: 413
diff changeset
341 'rss_rc': (1, 60),
b4ff26eb2c43 adjusting some surge protection limits
Thomas Waldmann <tw@waldmann-edv.de>
parents: 413
diff changeset
342 'default': (30, 60),
411
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
343 }
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
344 surge_lockout_time = 3600 # secs you get locked out when you ignore warnings
6e2114f8e942 fixed version, surge protection configuration, merged CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 403
diff changeset
345
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
346 theme_default = 'modern'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
347 theme_force = False
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
348 trail_size = 5
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
349 tz_offset = 0.0 # default time zone offset in hours from UTC
238
b80624429934 added cfg.user_autocreate, for now for auth.http and auth.ssl_clientcert
Thomas Waldmann <tw@waldmann-edv.de>
parents: 221
diff changeset
350 user_autocreate = False # do we auto-create user profiles
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
351 user_email_unique = True # do we check whether a user's email is unique?
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
352
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
353 # a regex of HTTP_USER_AGENTS that should be excluded from logging
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
354 # and receive a FORBIDDEN for anything except viewing a page
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
355 ua_spiders = ('archiver|cfetch|crawler|curl|gigabot|google|holmes|htdig|httrack|httpunit|jeeves|larbin|leech|'
346
bcc168855115 updated i18n, added omniexplorer to bot list
Thomas Waldmann <tw@waldmann-edv.de>
parents: 297
diff changeset
356 'linkbot|linkmap|linkwalk|mercator|mirror|msnbot|nutbot|omniexplorer|puf|robot|scooter|'
439
05175e00f75a add webreaper to bot list
Thomas Waldmann <tw@waldmann-edv.de>
parents: 420
diff changeset
357 'search|sherlock|sitecheck|spider|teleport|voyager|webreaper|wget')
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
358
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
359 # Wiki identity
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
360 sitename = u'Untitled Wiki'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
361 url_prefix = '/wiki'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
362 logo_string = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
363 interwikiname = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
364
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
365 url_mappings = {}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
366
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
367 user_checkbox_fields = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
368 ('mailto_author', lambda _: _('Publish my email (not my wiki homepage) in author info')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
369 ('edit_on_doubleclick', lambda _: _('Open editor on double click')),
213
f805911716a3 Clarified remember_last_visit text.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 211
diff changeset
370 ('remember_last_visit', lambda _: _('Jump to last visited page instead of frontpage')),
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
371 ('show_nonexist_qm', lambda _: _('Show question mark for non-existing pagelinks')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
372 ('show_page_trail', lambda _: _('Show page trail')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
373 ('show_toolbar', lambda _: _('Show icon toolbar')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
374 ('show_topbottom', lambda _: _('Show top/bottom links in headings')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
375 ('show_fancy_diff', lambda _: _('Show fancy diffs')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
376 ('wikiname_add_spaces', lambda _: _('Add spaces to displayed wiki names')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
377 ('remember_me', lambda _: _('Remember login information')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
378 ('want_trivial', lambda _: _('Subscribe to trivial changes')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
379
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
380 ('disabled', lambda _: _('Disable this account forever')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
381 # if an account is disabled, it may be used for looking up
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
382 # id -> username for page info and recent changes, but it
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
383 # is not usable for the user any more:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
384 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
385 user_checkbox_defaults = {'mailto_author': 0,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
386 'edit_on_doubleclick': 0,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
387 'remember_last_visit': 0,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
388 'show_nonexist_qm': nonexist_qm,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
389 'show_page_trail': 1,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
390 'show_toolbar': 1,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
391 'show_topbottom': 0,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
392 'show_fancy_diff': 1,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
393 'wikiname_add_spaces': 0,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
394 'remember_me': 1,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
395 'want_trivial': 0,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
396 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
397 # don't let the user change those
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
398 # user_checkbox_disable = ['disabled', 'want_trivial']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
399 user_checkbox_disable = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
400
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
401 # remove those checkboxes:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
402 #user_checkbox_remove = ['edit_on_doubleclick', 'show_nonexist_qm', 'show_toolbar', 'show_topbottom',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
403 # 'show_fancy_diff', 'wikiname_add_spaces', 'remember_me', 'disabled',]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
404 user_checkbox_remove = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
405
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
406 user_form_fields = [
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
407 ('name', _('Name'), "text", "36", _("(Use Firstname''''''Lastname)")),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
408 ('aliasname', _('Alias-Name'), "text", "36", ''),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
409 ('password', _('Password'), "password", "36", ''),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
410 ('password2', _('Password repeat'), "password", "36", _('(Only when changing passwords)')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
411 ('email', _('Email'), "text", "36", ''),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
412 ('css_url', _('User CSS URL'), "text", "40", _('(Leave it empty for disabling user CSS)')),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
413 ('edit_rows', _('Editor size'), "text", "3", ''),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
414 ##('theme', _('Preferred theme'), [self._theme_select()])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
415 ##('', _('Editor Preference'), [self._editor_default_select()])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
416 ##('', _('Editor shown on UI'), [self._editor_ui_select()])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
417 ##('', _('Time zone'), [self._tz_select()])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
418 ##('', _('Date format'), [self._dtfmt_select()])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
419 ##('', _('Preferred language'), [self._lang_select()])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
420 ]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
421 user_form_defaults = { # key: default
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
422 'name': '',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
423 'aliasname': '',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
424 'password': '',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
425 'password2': '',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
426 'email': '',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
427 'css_url': '',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
428 'edit_rows': "20",
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
429 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
430 # don't let the user change those, but show them:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
431 #user_form_disable = ['name', 'aliasname', 'email',]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
432 user_form_disable = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
433
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
434 # remove those completely:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
435 #user_form_remove = ['password', 'password2', 'css_url', 'logout', 'create', 'account_sendmail',]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
436 user_form_remove = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
437
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
438 # attributes we do NOT save to the userpref file
265
2cbc7dc436d7 auth changes: added u.auth_method, u.auth_attribs and some debug code. Support for switching off some form fields.
Thomas Waldmann <tw@waldmann-edv.de>
parents: 238
diff changeset
439 user_transient_fields = ['id', 'valid', 'may', 'auth_username', 'trusted', 'password', 'password2', 'auth_method', 'auth_attribs']
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
440
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
441 user_homewiki = 'Self' # interwiki name for where user homepages are located
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
442
113
7785febd9530 Refactored unzipping settings into multiconfig. Untested.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 99
diff changeset
443 unzip_single_file_size = 2.0 * 1000**2
7785febd9530 Refactored unzipping settings into multiconfig. Untested.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 99
diff changeset
444 unzip_attachments_space = 200.0 * 1000**2
117
4775d5ff5f40 attachment unzipper: handle file count quota-like as it was done with size
Thomas Waldmann <tw@waldmann-edv.de>
parents: 116
diff changeset
445 unzip_attachments_count = 51 # 1 zip file + 50 files contained in it
113
7785febd9530 Refactored unzipping settings into multiconfig. Untested.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 99
diff changeset
446
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
447 xmlrpc_putpage_enabled = 0 # if 0, putpage will write to a test page only
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
448 xmlrpc_putpage_trusted_only = 1 # if 1, you will need to be http auth authenticated
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
449
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
450 SecurityPolicy = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
451
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
452 def __init__(self, siteid):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
453 """ Init Config instance """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
454 self.siteid = siteid
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
455 if self.config_check_enabled:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
456 self._config_check()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
457
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
458 # define directories
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
459 self.moinmoin_dir = os.path.abspath(os.path.dirname(__file__))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
460 data_dir = os.path.normpath(self.data_dir)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
461 self.data_dir = data_dir
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
462 for dirname in ('user', 'cache', 'plugin'):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
463 name = dirname + '_dir'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
464 if not getattr(self, name, None):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
465 setattr(self, name, os.path.join(data_dir, dirname))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
466
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
467 # Try to decode certain names which allow unicode
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
468 self._decode()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
469
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
470 self._check_directories()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
471
449
8ec16f62e989 Moved type check of the superuser setting.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 445
diff changeset
472 if not isinstance(self.superuser, list):
8ec16f62e989 Moved type check of the superuser setting.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 445
diff changeset
473 msg = """The superuser</b> setting in your wiki configuration is not a list
8ec16f62e989 Moved type check of the superuser setting.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 445
diff changeset
474 (e.g. ['Sample User', 'AnotherUser']).
8ec16f62e989 Moved type check of the superuser setting.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 445
diff changeset
475 Please change it in your wiki configuration and try again."""
8ec16f62e989 Moved type check of the superuser setting.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 445
diff changeset
476 raise error.ConfigurationError(msg)
8ec16f62e989 Moved type check of the superuser setting.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 445
diff changeset
477
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
478 self._loadPluginModule()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
479
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
480 # Preparse user dicts
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
481 self._fillDicts()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
482
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
483 # Normalize values
131
1738cbba372c new cfg settings: language_ignore_browser and language_default (was: default_lang)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 117
diff changeset
484 self.language_default = self.language_default.lower()
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
485
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
486 # Use site name as default name-logo
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
487 if self.logo_string is None:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
488 self.logo_string = self.sitename
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
489
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
490 # Check for needed modules
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
491
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
492 # FIXME: maybe we should do this check later, just before a
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
493 # chart is needed, maybe in the chart module, instead doing it
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
494 # for each request. But this require a large refactoring of
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
495 # current code.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
496 if self.chart_options:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
497 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
498 import gdchart
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
499 except ImportError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
500 self.chart_options = None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
501
65
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
502 # post process
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
503 # we replace any string placeholders with config values
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
504 # e.g u'%(page_front_page)s' % self
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
505 self.navi_bar = [elem % self for elem in self.navi_bar]
65
4e7363862453 WikiBackup: add bzip2 support, fix traceback when backup is not allowed, cleanup
Nir Soffer <nirs@freeshell.org>
parents: 63
diff changeset
506 self.backup_exclude = [elem % self for elem in self.backup_exclude]
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
507
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
508 # list to cache lupy searcher objects
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
509 self.lupy_searchers = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
510
18
316340dd9a7f remove subscribe icon in classic when no mail is enabled. fix check for sendmail.
Thomas Waldmann <tw@waldmann-edv.de>
parents: 15
diff changeset
511 # check if mail is possible and set flag:
395
416fe98eb08f 1.5.1 release: bump revision, minor globaledit script and mail check fixes, updated test output, updated CHANGES
Thomas Waldmann <tw@waldmann-edv.de>
parents: 371
diff changeset
512 self.mail_enabled = (self.mail_smarthost is not None or self.mail_sendmail is not None) and self.mail_from
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
513
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
514 def _config_check(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
515 """ Check namespace and warn about unknown names
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
516
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
517 Warn about names which are not used by DefaultConfig, except
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
518 modules, classes, _private or __magic__ names.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
519
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
520 This check is disabled by default, when enabled, it will show an
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
521 error message with unknown names.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
522 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
523 unknown = ['"%s"' % name for name in dir(self)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
524 if not name.startswith('_') and
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
525 not DefaultConfig.__dict__.has_key(name) and
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
526 not isinstance(getattr(self, name), (type(sys), type(DefaultConfig)))]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
527 if unknown:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
528 msg = """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
529 Unknown configuration options: %s.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
530
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
531 For more information, visit HelpOnConfiguration. Please check your
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
532 configuration for typos before requesting support or reporting a bug.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
533 """ % ', '.join(unknown)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
534 raise error.ConfigurationError(msg)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
535
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
536 def _decode(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
537 """ Try to decode certain names, ignore unicode values
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
538
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
539 Try to decode str using utf-8. If the decode fail, raise FatalError.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
540
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
541 Certain config variables should contain unicode values, and
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
542 should be defined with u'text' syntax. Python decode these if
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
543 the file have a 'coding' line.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
544
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
545 This will allow utf-8 users to use simple strings using, without
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
546 using u'string'. Other users will have to use u'string' for
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
547 these names, because we don't know what is the charset of the
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
548 config files.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
549 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
550 charset = 'utf-8'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
551 message = u'''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
552 "%(name)s" configuration variable is a string, but should be
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
553 unicode. Use %(name)s = u"value" syntax for unicode variables.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
554
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
555 Also check your "-*- coding -*-" line at the top of your configuration
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
556 file. It should match the actual charset of the configuration file.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
557 '''
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
558
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
559 decode_names = (
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
560 'sitename', 'logo_string', 'navi_bar', 'page_front_page',
413
c85132ab35e3 Removed form code (which had been broken since it was hacked into) and the export action (which had been in a similar state).
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 411
diff changeset
561 'page_category_regex', 'page_dict_regex',
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
562 'page_group_regex', 'page_template_regex', 'page_license_page',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
563 'page_local_spelling_words', 'acl_rights_default',
63
d1333236adba backward compability with 1.3 mail_from configuration, update example configuration, add tests
Nir Soffer <nirs@freeshell.org>
parents: 55
diff changeset
564 'acl_rights_before', 'acl_rights_after', 'mail_from'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
565 )
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
566
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
567 for name in decode_names:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
568 attr = getattr(self, name, None)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
569 if attr:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
570 # Try to decode strings
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
571 if isinstance(attr, str):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
572 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
573 setattr(self, name, unicode(attr, charset))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
574 except UnicodeError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
575 raise error.ConfigurationError(message %
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
576 {'name': name})
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
577 # Look into lists and try to decode strings inside them
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
578 elif isinstance(attr, list):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
579 for i in xrange(len(attr)):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
580 item = attr[i]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
581 if isinstance(item, str):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
582 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
583 attr[i] = unicode(item, charset)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
584 except UnicodeError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
585 raise error.ConfigurationError(message %
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
586 {'name': name})
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
587
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
588 def _check_directories(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
589 """ Make sure directories are accessible
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
590
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
591 Both data and underlay should exists and allow read, write and
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
592 execute.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
593 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
594 mode = os.F_OK | os.R_OK | os.W_OK | os.X_OK
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
595 for attr in ('data_dir', 'data_underlay_dir'):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
596 path = getattr(self, attr)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
597
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
598 # allow an empty underlay path or None
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
599 if attr == 'data_underlay_dir' and not path:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
600 continue
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
601
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
602 path_pages = os.path.join(path, "pages")
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
603 if not (os.path.isdir(path_pages) and os.access(path_pages, mode)):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
604 msg = '''
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
605 %(attr)s "%(path)s" does not exists, or has incorrect ownership or
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
606 permissions.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
607
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
608 Make sure the directory and the subdirectory pages are owned by the web
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
609 server and are readable, writable and executable by the web server user
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
610 and group.
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
611
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
612 It is recommended to use absolute paths and not relative paths. Check
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
613 also the spelling of the directory name.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
614 ''' % {'attr': attr, 'path': path,}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
615 raise error.ConfigurationError(msg)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
616
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
617 def _loadPluginModule(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
618 """ import plugin module under configname.plugin
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
619
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
620 To be able to import plugin from arbitrary path, we have to load
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
621 the base package once using imp.load_module. Later, we can use
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
622 standard __import__ call to load plugins in this package.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
623
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
624 Since each wiki has unique plugins, we load the plugin package
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
625 under the wiki configuration module, named self.siteid.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
626 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
627 import sys, imp
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
628
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
629 name = self.siteid + '.plugin'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
630 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
631 # Lock other threads while we check and import
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
632 imp.acquire_lock()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
633 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
634 # If the module is not loaded, try to load it
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
635 if not name in sys.modules:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
636 # Find module on disk and try to load - slow!
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
637 plugin_parent_dir = os.path.abspath(os.path.join(self.plugin_dir, '..'))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
638 fp, path, info = imp.find_module('plugin', [plugin_parent_dir])
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
639 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
640 # Load the module and set in sys.modules
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
641 module = imp.load_module(name, fp, path, info)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
642 sys.modules[self.siteid].plugin = module
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
643 finally:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
644 # Make sure fp is closed properly
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
645 if fp:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
646 fp.close()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
647 finally:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
648 imp.release_lock()
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
649 except ImportError, err:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
650 msg = '''
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 38
diff changeset
651 Could not import plugin package "%(path)s/plugin" because of ImportError:
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
652 %(err)s.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
653
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
654 Make sure your data directory path is correct, check permissions, and
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
655 that the data/plugin directory has an __init__.py file.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
656 ''' % {'path': self.data_dir, 'err': str(err)}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
657 raise error.ConfigurationError(msg)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
658
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
659 def _fillDicts(self):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
660 """ fill config dicts
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
661
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
662 Fills in missing dict keys of derived user config by copying
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
663 them from this base class.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
664 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
665 # user checkbox defaults
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
666 for key, value in DefaultConfig.user_checkbox_defaults.items():
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
667 if not self.user_checkbox_defaults.has_key(key):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
668 self.user_checkbox_defaults[key] = value
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
669
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
670 def __getitem__(self, item):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
671 """ Make it possible to access a config object like a dict """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
672 return getattr(self, item)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
673
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
674 # remove the gettext pseudo function
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
675 del _
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
676