MoinMoin/config/__init__.py
author Thomas Waldmann <tw AT waldmann-edv DOT de>
Fri, 17 Oct 2014 21:44:40 +0200
changeset 6086 dbe605c5867c
parent 5922 25900eaeb864
permissions -rw-r--r--
updated underlay
     1 # -*- coding: iso-8859-1 -*-
     2 """
     3     MoinMoin - site-wide configuration defaults (NOT per single wiki!)
     4 
     5     @copyright: 2005-2006 MoinMoin:ThomasWaldmann
     6     @license: GNU GPL, see COPYING for details.
     7 """
     8 import re
     9 from MoinMoin import version
    10 
    11 # unicode: set the char types (upper, lower, digits, spaces)
    12 from MoinMoin.util.chartypes import *
    13 
    14 # List of image types browser do support regulary
    15 browser_supported_images = ('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', )
    16 
    17 # Parser to use mimetype text
    18 parser_text_mimetype = ('plain', 'csv', 'rst', 'docbook', 'latex', 'tex', 'html', 'css',
    19                        'xml', 'python', 'perl', 'php', 'ruby', 'javascript',
    20                        'cplusplus', 'java', 'pascal', 'diff', 'gettext', 'xslt', 'creole', )
    21 
    22 # When creating files, we use e.g. 0666 & config.umask for the mode:
    23 umask = 0770
    24 
    25 # list of acceptable password hashing schemes for cfg.password_scheme,
    26 # here we only give reasonably good schemes, which is passlib (if we
    27 # have passlib) and ssha (if we only have builtin stuff):
    28 password_schemes_configurable = ['{PASSLIB}', '{SSHA}', ]
    29 
    30 # ordered list of supported password hashing schemes, best (passlib) should be
    31 # first, best builtin one should be second. this is what we support if we
    32 # encounter it in user profiles:
    33 password_schemes_supported = password_schemes_configurable + ['{SHA}', '{APR1}', '{MD5}', '{DES}', ]
    34 
    35 # Default value for the static stuff URL prefix (css, img, js).
    36 # Caution:
    37 # * do NOT use this directly, it is only the DEFAULT value to be used by
    38 #   server Config classes and by multiconfig.py for request.cfg.
    39 # * must NOT end with '/'!
    40 # * some servers expect '/' at beginning and only 1 level deep.
    41 url_prefix_static = '/moin_static' + version.release_short
    42 
    43 # Threads flag - if you write a moin server that use threads, import
    44 # config in the server and set this flag to True.
    45 use_threads = False
    46 
    47 # Charset - we support only 'utf-8'. While older encodings might work,
    48 # we don't have the resources to test them, and there is no real
    49 # benefit for the user. IMPORTANT: use only lowercase 'utf-8'!
    50 charset = 'utf-8'
    51 
    52 # Regex to find lower->upper transitions (word boundaries in WikiNames), used by split_title
    53 split_regex = re.compile('([%s])([%s])' % (chars_lower, chars_upper), re.UNICODE)
    54 
    55 # Invalid characters - invisible characters that should not be in page
    56 # names. Prevent user confusion and wiki abuse, e.g u'\u202aFrontPage'.
    57 page_invalid_chars_regex = re.compile(
    58     ur"""
    59     \u0000 | # NULL
    60 
    61     # Bidi control characters
    62     \u202A | # LRE
    63     \u202B | # RLE
    64     \u202C | # PDF
    65     \u202D | # LRM
    66     \u202E   # RLM
    67     """,
    68     re.UNICODE | re.VERBOSE
    69     )
    70 
    71 # used for wikiutil.clean_input
    72 clean_input_translation_map = {
    73     # these chars will be replaced by blanks
    74     ord(u'\t'): u' ',
    75     ord(u'\r'): u' ',
    76     ord(u'\n'): u' ',
    77 }
    78 for c in u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f' \
    79           '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f':
    80     # these chars will be removed
    81     clean_input_translation_map[ord(c)] = None
    82 del c
    83 
    84 # Other stuff
    85 url_schemas = ['http', 'https', 'ftp', 'file',
    86                'mailto', 'nntp', 'news',
    87                'ssh', 'telnet', 'irc', 'ircs', 'xmpp', 'mumble',
    88                'webcal', 'ed2k', 'apt', 'rootz',
    89                'gopher',
    90                'notes',
    91                'rtp', 'rtsp', 'rtcp',
    92               ]
    93 
    94 smileys = (r"X-( :D <:( :o :( :) B) :)) ;) /!\ <!> (!) :-? :\ >:> |) " +
    95            r":-( :-) B-) :-)) ;-) |-) (./) {OK} {X} {i} {1} {2} {3} {*} {o}").split()