moin-2.0 / wikiconfig.py

# -*- coding: utf-8 -*-
"""MoinMoin Wiki - Configuration"""

import sys, os

from MoinMoin.config.default import DefaultConfig
from MoinMoin.storage.backends import create_simple_mapping
from MoinMoin.util.interwiki import InterWikiMap


class Config(DefaultConfig):
    # vvv DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO vvv
    # Directory containing THIS wikiconfig:
    wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))

    # We assume this structure for a simple "unpack and run" scenario:
    # wikiconfig.py
    # wiki/
    #      data/
    # contrib/
    #      xml/
    #          preloaded_items.xml
    # If that's not true, feel free to adjust the pathes.
    instance_dir = os.path.join(wikiconfig_dir, 'wiki')
    data_dir = os.path.join(instance_dir, 'data') # Note: this used to have a trailing / in the past

    # This puts the contents from the specified xml file (a serialized backend) into your
    # backend(s). You can remove this after the first request to your wiki or
    # from the beginning if you don't want to use this feature at all.
    load_xml = os.path.join(wikiconfig_dir, 'contrib', 'xml', 'preloaded_items.xml')
    #save_xml = os.path.join(wikiconfig_dir, 'contrib', 'xml', 'saved_items.xml')

    # This provides a simple default setup for your backend configuration.
    # 'fs:' indicates that you want to use the filesystem backend. You can also use
    # 'hg:' instead to indicate that you want to use the mercurial backend.
    # Alternatively you can set up the mapping yourself (see HelpOnStorageConfiguration).
    namespace_mapping, router_index_uri = create_simple_mapping(
                            backend_uri='fs2:%s/%%(nsname)s' % data_dir,
                            # XXX we use rather relaxed ACLs for the development wiki:
                            content_acl=dict(before=u'',
                                             default=u'All:read,write,create,destroy,admin',
                                             after=u'', ),
                            user_profile_acl=dict(before=u'',
                                             default=u'All:read,write,create,destroy,admin',
                                             after=u'', ),
                            )

    # Load the interwiki map from intermap.txt:
    interwiki_map = InterWikiMap.from_file(os.path.join(wikiconfig_dir, 'contrib', 'interwiki', 'intermap.txt')).iwmap

    sitename = u'My MoinMoin'

    # for now we load some 3rd party stuff from the place within moin where it is currently located,
    # but soon we'll get rid of this stuff:
    serve_files = dict(
        # see "quickinstall" script about how to get those files there
        ckeditor = os.path.join(wikiconfig_dir, 'env', 'ckeditor'),
        jquery = os.path.join(wikiconfig_dir, 'env', 'jquery'),
        svgweb = os.path.join(wikiconfig_dir, 'env', 'svgweb', 'src'),
        anywikidraw = os.path.join(wikiconfig_dir, 'env', 'AnyWikiDraw', 'anywikidraw', 'moinmoin'),
        twikidraw = os.path.join(wikiconfig_dir, 'env', 'TWikiDrawPlugin'),
        svgedit = os.path.join(wikiconfig_dir, 'env', 'svg-edit'),
    )

    # ^^^ DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO ^^^

    #item_root = u'Home' # change to some better value


MOINCFG = Config # Flask only likes uppercase stuff
# Flask settings - see the flask documentation about their meaning
SECRET_KEY = 'you need to change this so it is really secret'
#DEBUG = False # use True for development only, not for public sites!
#TESTING = False
#SESSION_COOKIE_NAME = 'session'
#PERMANENT_SESSION_LIFETIME = timedelta(days=31)
#USE_X_SENDFILE = False
#LOGGER_NAME = 'MoinMoin'
#config for flask-cache:
#CACHE_TYPE = 'filesystem'
#CACHE_DIR = '/path/to/flask-cache-dir'

# DEVELOPERS! Do not add your configuration items here - you could accidentally
# commit them! Instead, create a wikiconfig_local.py file containing this:
#
#from wikiconfig import *
#
#class LocalConfig(Config):
#    configuration_item_1 = 'value1'
#
#MOINCFG = LocalConfig
#DEBUG = True
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.