annotate MoinMoin/_tests/wikiconfig.py @ 6028:1893da1d5213

userid lookup caches: use 1 on-disk cache file, update cache rather than rebuild Before this, we maintained one cache file per attribute (e.g. name2id, openid2id, ...) - the related code did multiple passes over all user profiles to rebuild these cache files. Now doing a one-pass rebuild, writing all attribute -> userid mappings into one on-disk cache file called "lookup". Additionally to "name" and "openids", support fast lookup for "email" and "jid" also. On profile save, we use to just kill the cache and let it rebuild. Now the cache is read, updated and written back (which is much less expensive for wikis with more than a few users). Did some refactoring also, reducing duplication, breaking down the code into smaller functions / methods.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Feb 2014 18:22:10 +0100
parents 25900eaeb864
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
3 MoinMoin - test wiki configuration
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
5 Do not change any values without good reason.
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
6
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
7 We mostly want to have default values here, except for stuff that doesn't
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
8 work without setting them (like data_dir and underlay_dir).
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
9
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10 @copyright: 2000-2004 by Juergen 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
11 @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
12 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1603
diff changeset
14 import os
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1603
diff changeset
15
1065
cd5c2aed0c31 fix tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 578
diff changeset
16 from MoinMoin.config.multiconfig import DefaultConfig
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
17
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
18
4863
69073f6b028a Groups2009: Dicts and groups values are defined in the config.multiconfig. _tests.wikiconfig_groups was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4788
diff changeset
19 class Config(DefaultConfig):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
20 sitename = u'Developer Test Wiki'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
21 logo_string = sitename
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1603
diff changeset
22
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
23 _base_dir = os.path.join(os.path.dirname(__file__), '../../tests/wiki')
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1603
diff changeset
24 data_dir = os.path.join(_base_dir, "data")
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1603
diff changeset
25 data_underlay_dir = os.path.join(_base_dir, "underlay")
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1603
diff changeset
26
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
27 #show_hosts = 1
3873
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2286
diff changeset
28
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3873
diff changeset
29 #secrets = 'some not secret string just to make tests happy'
3873
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2286
diff changeset
30
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2006
diff changeset
31 # used to check if it is really a wiki we may modify
81
dcbfffac3f9c Added class variable to the test wiki config in order to be able to distinguish it.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
32 is_test_wiki = True
4788
1ff6498db9ec Groups2009: wikiconfig_groups.py is used for the groups-related configuration instead of altering wikiconfig.py in _tests. wiki_group backend is used by default to access group definitions.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4786
diff changeset
33
5922
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
34 # for runnging tests without passlib support:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
35 #passlib_support = False
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
36 #password_scheme = '{SSHA}'
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
37
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
38 # for running tests with passlib support:
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
39 passlib_crypt_context = dict(
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
40 schemes=["sha512_crypt", ],
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
41 # for the tests, we don't want to have varying rounds
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
42 sha512_crypt__vary_rounds=0,
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
43 # for the tests, we want to have a rather low rounds count,
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
44 # so the tests run quickly (do NOT use low counts in production!)
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
45 sha512_crypt__default_rounds=1001,
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
46 )
25900eaeb864 passlib integration - enhanced password hash security
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4863
diff changeset
47