annotate wikiconfig.py @ 2915:0b30aa1fa138

fixes #496 Password checker bypassed when user resets password
author Yask Srivastava <yask123@gmail.com>
date Sat, 28 Feb 2015 23:58:11 -0800
parents 82ffb3f45eed
children 6dd6f10636b3
rev   line source
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
2 """
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
3 MoinMoin Wiki - Configuration
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
5 Developers can use this configuration to run moin right from their mercurial workdir.
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
6 """
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
7
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
8 import os
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 from MoinMoin.config.default import DefaultConfig
851
cd8afd44521e storage fixes / extensions, made ACLs work, updated MoinMoin.config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 759
diff changeset
11 from MoinMoin.storage import create_simple_mapping
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 from MoinMoin.util.interwiki import InterWikiMap
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 class Config(DefaultConfig):
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16 # Directory containing THIS wikiconfig:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 # We assume this structure for a simple "unpack and run" scenario:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 # wikiconfig.py
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 # wiki/
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 # data/
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
22 # index/
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 # contrib/
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
24 # interwiki/
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
25 # intermap.txt
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 # If that's not true, feel free to adjust the pathes.
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 instance_dir = os.path.join(wikiconfig_dir, 'wiki')
1975
384555088cab lots of pep8 fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1832
diff changeset
28 data_dir = os.path.join(instance_dir, 'data') # Note: this used to have a trailing / in the past
1780
4a054063fbb0 make whoosh storage type and params configurable, updated docs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1425
diff changeset
29 index_storage = 'FileStorage', (os.path.join(instance_dir, "index"), ), {}
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 # This provides a simple default setup for your backend configuration.
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
32 # 'stores:fs:...' indicates that you want to use the filesystem backend.
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 # Alternatively you can set up the mapping yourself (see HelpOnStorageConfiguration).
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
34 namespace_mapping, backend_mapping, acl_mapping = create_simple_mapping(
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
35 uri='stores:fs:{0}/%(backend)s/%(kind)s'.format(data_dir),
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
36 # XXX we use rather relaxed ACLs for the development wiki:
2066
9cf6a6b474c5 rename create_simple_mapping() acl param names, you may need to update your wikiconfig!
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2011
diff changeset
37 default_acl=dict(before=u'',
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
38 default=u'All:read,write,create,destroy,admin',
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
39 after=u'',
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
40 hierarchic=False, ),
2066
9cf6a6b474c5 rename create_simple_mapping() acl param names, you may need to update your wikiconfig!
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2011
diff changeset
41 userprofiles_acl=dict(before=u'',
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
42 default=u'All:read,write,create,destroy,admin',
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
43 after=u'',
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
44 hierarchic=False, ),
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
45 )
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
47 # for display purposes:
536
99426ee77abb revert cs 77f05fbc7d7e
Akash Sinha <akash2607@gmail.com>
parents: 531
diff changeset
48 sitename = u'My MoinMoin'
99426ee77abb revert cs 77f05fbc7d7e
Akash Sinha <akash2607@gmail.com>
parents: 531
diff changeset
49 # it is required that you set this to a unique, stable and non-empty name:
99426ee77abb revert cs 77f05fbc7d7e
Akash Sinha <akash2607@gmail.com>
parents: 531
diff changeset
50 interwikiname = u'MyMoinMoin'
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51 # Load the interwiki map from intermap.txt:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 interwiki_map = InterWikiMap.from_file(os.path.join(wikiconfig_dir, 'contrib', 'interwiki', 'intermap.txt')).iwmap
311
902378b07e99 simplify interwiki resolution, remove special case for 'Self' / own interwikiname
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 285
diff changeset
53 # we must add entries for 'Self' and our interwikiname:
1158
fa625d1aca82 fix installation and server documentation for windows, fix scripts to work as documented under windows; fixes #114, #122, #128
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1056
diff changeset
54 interwiki_map[interwikiname] = 'http://127.0.0.1:8080/'
fa625d1aca82 fix installation and server documentation for windows, fix scripts to work as documented under windows; fixes #114, #122, #128
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1056
diff changeset
55 interwiki_map['Self'] = 'http://127.0.0.1:8080/'
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
57 # setup static files' serving:
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 serve_files = dict(
1395
249b7900fe28 fix some pep8 issues, remove the fixed files from pep8 checker's exlusion list
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1299
diff changeset
59 docs=os.path.join(wikiconfig_dir, 'docs', '_build', 'html'), # html docs made by sphinx
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60 )
1299
49507d0ee5c8 update wikiconfig.py (remove outdated stuff, cosmetics)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1240
diff changeset
61 # see https://bitbucket.org/thomaswaldmann/xstatic for infos about xstatic:
285
865c3780d091 upgrade to XStatic 0.0.2 and packages made for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 282
diff changeset
62 from xstatic.main import XStatic
1822
d7fb86b446ab CSS and javascript changes to support obsolete IE7 and IE8 browsers,
Roger Haase <crosseyedpenguin@yahoo.com>
parents: 1780
diff changeset
63 # names below must be package names
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
64 mod_names = [
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
65 'jquery', 'jquery_file_upload',
2119
6998aedec89f require xstatic-bootstrap package with twitter bootstrap
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2066
diff changeset
66 'bootstrap',
2140
56ca9d2dcfc9 upgrade to bootstrap v3, add font-awesome
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2119
diff changeset
67 'font_awesome',
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
68 'ckeditor',
2365
9f4e725f9868 textarea auto-resize plugin added as an xstatic package
sharky93 <rishabhr123@gmail.com>
parents: 2140
diff changeset
69 'autosize',
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
70 'svgedit_moin', 'twikidraw_moin', 'anywikidraw',
2632
647ee04f863e Added XStatic.JQuery.TableSorter plugin in +tickets view
Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
parents: 2589
diff changeset
71 'jquery_tablesorter',
2649
82ffb3f45eed Added pygments css classes in basic theme by installing pygments Xstatic package in the virtual environment and importing css files from there. Also removed the manually added pygments definitions in the foobar and modernized themes and imported pygments css in the same wasy as done in the basic theme.
Ajitesh Gupta <ajgupta93@gmail.com>
parents: 2632
diff changeset
72 'pygments',
2011
791bdedb0c20 fix lots of pep8 issues, mainly E12x
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1975
diff changeset
73 ]
285
865c3780d091 upgrade to XStatic 0.0.2 and packages made for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 282
diff changeset
74 pkg = __import__('xstatic.pkg', fromlist=mod_names)
865c3780d091 upgrade to XStatic 0.0.2 and packages made for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 282
diff changeset
75 for mod_name in mod_names:
865c3780d091 upgrade to XStatic 0.0.2 and packages made for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 282
diff changeset
76 mod = getattr(pkg, mod_name)
865c3780d091 upgrade to XStatic 0.0.2 and packages made for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 282
diff changeset
77 xs = XStatic(mod, root_url='/static', provider='local', protocol='http')
2585
195b134c71f9 wikiconfig.py: simplify static file serving setup code
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2519
diff changeset
78 serve_files[xs.name] = xs.base_dir
282
d28a3434b40c use XStatic-svg-edit-moin==2011.07.07.1, require it via setup.py, remove it from quickinstall scripts
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 276
diff changeset
79
2149
2e7e81a3133f admin traceback emails
Ana Balica <ana.balica@gmail.com>
parents: 2119
diff changeset
80 # list of admin emails
2e7e81a3133f admin traceback emails
Ana Balica <ana.balica@gmail.com>
parents: 2119
diff changeset
81 admin_emails = []
2e7e81a3133f admin traceback emails
Ana Balica <ana.balica@gmail.com>
parents: 2119
diff changeset
82 # send tracebacks to admins
2e7e81a3133f admin traceback emails
Ana Balica <ana.balica@gmail.com>
parents: 2119
diff changeset
83 email_tracebacks = False
2e7e81a3133f admin traceback emails
Ana Balica <ana.balica@gmail.com>
parents: 2119
diff changeset
84
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85
1975
384555088cab lots of pep8 fixes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1832
diff changeset
86 MOINCFG = Config # Flask only likes uppercase stuff
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 # Flask settings - see the flask documentation about their meaning
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 SECRET_KEY = 'you need to change this so it is really secret'
2589
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
89 # DEBUG = False # use True for development only, not for public sites!
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
90 # TESTING = False
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
91 # SESSION_COOKIE_NAME = 'session'
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
92 # PERMANENT_SESSION_LIFETIME = timedelta(days=31)
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
93 # USE_X_SENDFILE = False
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
94 # LOGGER_NAME = 'MoinMoin'
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
95 # config for flask-cache:
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
96 # CACHE_TYPE = 'filesystem'
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
97 # CACHE_DIR = '/path/to/flask-cache-dir'
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 # DEVELOPERS! Do not add your configuration items here - you could accidentally
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 # commit them! Instead, create a wikiconfig_local.py file containing this:
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 #
2589
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
102 # from wikiconfig_editme import *
118
c9684bc241db add hint to wikiconfig about how to get config autoreload
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 110
diff changeset
103 #
c9684bc241db add hint to wikiconfig about how to get config autoreload
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 110
diff changeset
104 # In wikiconfig_editme.py (the indirection is needed so that the auto reload
c9684bc241db add hint to wikiconfig about how to get config autoreload
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 110
diff changeset
105 # mechanism of the builtin server works) you do this:
c9684bc241db add hint to wikiconfig about how to get config autoreload
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 110
diff changeset
106 #
2589
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
107 # from wikiconfig import *
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 #
2589
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
109 # class LocalConfig(Config):
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 # configuration_item_1 = 'value1'
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 #
2589
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
112 # MOINCFG = LocalConfig
ee404f81afe9 fix new pep8 errors generated after pep8 is upgraded to 1.5.1
RogerHaase <haaserd@gmail.com>
parents: 2585
diff changeset
113 # DEBUG = True