annotate MoinMoin/config/__init__.py @ 3339:a07ac5a0811e

moved definition of text mimetype for parsers into config
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 19 Mar 2008 18:31:01 +0100
parents 5f660b3c1cd7
children 87c26058d9c0
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 - site-wide configuration defaults (NOT per single wiki!)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1795
diff changeset
5 @copyright: 2005-2006 MoinMoin:ThomasWaldmann
0
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 import re
1582
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
9 from MoinMoin import version
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10
1795
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
11 # unicode: set the char types (upper, lower, digits, spaces)
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
12 from MoinMoin.util.chartypes import *
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13
3338
5f660b3c1cd7 moved browser_supported_images to config and exchanged it
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3110
diff changeset
14 # List of image types browser do support regulary
5f660b3c1cd7 moved browser_supported_images to config and exchanged it
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3110
diff changeset
15 browser_supported_images = ('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', )
5f660b3c1cd7 moved browser_supported_images to config and exchanged it
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3110
diff changeset
16
3339
a07ac5a0811e moved definition of text mimetype for parsers into config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3338
diff changeset
17 # Parser to use mimetype text
a07ac5a0811e moved definition of text mimetype for parsers into config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3338
diff changeset
18 parser_text_mimetype = ('plain', 'csv', 'rst', 'docbook', 'latex', 'tex', 'html', 'css',
a07ac5a0811e moved definition of text mimetype for parsers into config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3338
diff changeset
19 'xml', 'python', 'perl', 'php', 'ruby', 'javascript',
a07ac5a0811e moved definition of text mimetype for parsers into config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3338
diff changeset
20 'cplusplus', 'java', 'pascal', 'diff', 'gettext', 'xslt', 'creole', )
a07ac5a0811e moved definition of text mimetype for parsers into config
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 3338
diff changeset
21
1011
58f5af49cd03 move config and multiconfig to config/ package, see HINT in CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 734
diff changeset
22 # When creating files, we use e.g. 0666 & config.umask for the mode:
58f5af49cd03 move config and multiconfig to config/ package, see HINT in CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 734
diff changeset
23 umask = 0770
58f5af49cd03 move config and multiconfig to config/ package, see HINT in CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 734
diff changeset
24
1582
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
25 # Default value for the static stuff URL prefix (css, img, js).
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
26 # Caution:
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
27 # * do NOT use this directly, it is only the DEFAULT value to be used by
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
28 # server Config classes and by multiconfig.py for request.cfg.
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
29 # * must NOT end with '/'!
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
30 # * some servers expect '/' at beginning and only 1 level deep.
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
31 url_prefix_static = '/moin_static' + version.release_short
f37b49b6313d url_prefix_static: move default to MoinMoin.config, use matching defaults for Twisted/standalone
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1011
diff changeset
32
1795
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
33 # Threads flag - if you write a moin server that use threads, import
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
34 # config in the server and set this flag to True.
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
35 use_threads = False
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
36
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
37 # Charset - we support only 'utf-8'. While older encodings might work,
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
38 # we don't have the resources to test them, and there is no real
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
39 # benefit for the user. IMPORTANT: use only lowercase 'utf-8'!
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
40 charset = 'utf-8'
94887c1c1e8f direct import from chartypes, reorder config.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1582
diff changeset
41
2250
07fdbda38be2 move split_regex to config (so it is compiled only once)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2187
diff changeset
42 # Regex to find lower->upper transitions (word boundaries in WikiNames), used by split_title
2251
4197965b0820 fix: use re.UNICODE for split_regex
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2250
diff changeset
43 split_regex = re.compile('([%s])([%s])' % (chars_lower, chars_upper), re.UNICODE)
2250
07fdbda38be2 move split_regex to config (so it is compiled only once)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2187
diff changeset
44
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
45 # Invalid characters - invisible characters that should not be in page
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
46 # names. Prevent user confusion and wiki abuse, e.g u'\u202aFrontPage'.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
47 page_invalid_chars_regex = re.compile(
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
48 ur"""
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
49 \u0000 | # NULL
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
50
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
51 # Bidi control characters
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
52 \u202A | # LRE
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
53 \u202B | # RLE
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
54 \u202C | # PDF
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
55 \u202D | # LRM
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
56 \u202E # RLM
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
57 """,
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
58 re.UNICODE | re.VERBOSE
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
59 )
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
60
1922
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
61 # used for wikiutil.clean_input
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
62 clean_input_translation_map = {
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
63 # these chars will be replaced by blanks
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
64 ord(u'\t'): u' ',
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
65 ord(u'\r'): u' ',
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
66 ord(u'\n'): u' ',
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
67 }
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
68 for c in u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f' \
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
69 '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f':
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
70 # these chars will be removed
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
71 clean_input_translation_map[ord(c)] = None
2187
15c11fe8f6b2 config/multiconfig: minor cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1949
diff changeset
72 del c
1922
f486526720c5 renamed wikiutil.clean_comment > clean_input, moved translation map to config
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
73
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
74 # Other stuff
3052
1d3e65884337 copy moin wiki parser and its tests from 1.6 branch (cs 2558:3e3a549b49f0), keep _heading_repl from 1.7, update interwiki map to make tests happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2251
diff changeset
75 url_schemas = ['http', 'https', 'ftp', 'file',
1d3e65884337 copy moin wiki parser and its tests from 1.6 branch (cs 2558:3e3a549b49f0), keep _heading_repl from 1.7, update interwiki map to make tests happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2251
diff changeset
76 'mailto', 'nntp', 'news',
1d3e65884337 copy moin wiki parser and its tests from 1.6 branch (cs 2558:3e3a549b49f0), keep _heading_repl from 1.7, update interwiki map to make tests happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2251
diff changeset
77 'telnet', 'irc', 'ircs', 'xmpp',
1d3e65884337 copy moin wiki parser and its tests from 1.6 branch (cs 2558:3e3a549b49f0), keep _heading_repl from 1.7, update interwiki map to make tests happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2251
diff changeset
78 'webcal', 'ed2k', 'rootz',
1d3e65884337 copy moin wiki parser and its tests from 1.6 branch (cs 2558:3e3a549b49f0), keep _heading_repl from 1.7, update interwiki map to make tests happy
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2251
diff changeset
79 ]
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
80
734
bf2435e61f97 moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 729
diff changeset
81 smileys = (r"X-( :D <:( :o :( :) B) :)) ;) /!\ <!> (!) :-? :\ >:> |) " +
bf2435e61f97 moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 729
diff changeset
82 r":-( :-) B-) :-)) ;-) |-) (./) {OK} {X} {i} {1} {2} {3} {*} {o}").split()