def setup_module(module):
    tiddlywebwiki.init(config)
    module.serializer = Serializer('tiddlywebplugins.atom.feed',
            environ={'tiddlyweb.config': config})
    config['atom.author_uri_map'] = '/profiles/%s'
    config['atom.author_avatar_map'] = '/bags/%s_public/tiddlers/SiteIcon'
    config['atom.hub'] = 'http://pubsubhubbub.appspot.com/'
Пример #2
0
def setup_module(module):
    tiddlywebwiki.init(config)
    module.serializer = Serializer('tiddlywebplugins.atom.feed',
                                   environ={'tiddlyweb.config': config})
    config['atom.author_uri_map'] = '/profiles/%s'
    config['atom.author_avatar_map'] = '/bags/%s_public/tiddlers/SiteIcon'
    config['atom.hub'] = 'http://pubsubhubbub.appspot.com/'
Пример #3
0
def init(config):
    import tiddlywebwiki
    import tiddlywebplugins.register
    import tiddlywebplugins.wimporter
    import tiddlywebplugins.logout
    import tiddlywebplugins.form

    merge_config(config, hoster_config)

    tiddlywebwiki.init(config)
    tiddlywebplugins.register.init(config)
    tiddlywebplugins.wimporter.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.form.init(config)

    merge_config(config, hoster_config)

    if 'selector' in config:
        remove_handler(config['selector'], '/{recipe_name:segment}')
        replace_handler(config['selector'], '/', dict(GET=front))
        config['selector'].add('/help', GET=help_page)
        config['selector'].add('/login', GET=login)
        config['selector'].add('/uploader', GET=uploader)
        config['selector'].add('/formeditor',
                               GET=get_tiddler_edit,
                               POST=post_tiddler_edit)
        config['selector'].add('/addemail', POST=add_email)
        config['selector'].add('/follow', POST=add_friend)
        config['selector'].add('/members', GET=members_list)
        config['selector'].add('/bagfavor', POST=bag_favor)
        config['selector'].add('/recipefavor', POST=recipe_favor)
        config['selector'].add('/bagpolicy', POST=entity_policy)
        config['selector'].add('/recipepolicy', POST=entity_policy)
        config['selector'].add('/createrecipe',
                               GET=get_createrecipe,
                               POST=post_createrecipe)
        config['selector'].add('/createbag',
                               GET=get_createbag,
                               POST=post_createbag)
        config['selector'].add('/feedbag[.{format}]', GET=public_stuff)
        config['selector'].add('/home', GET=get_home)
        # THE FOLLOWING MUST COME LAST
        config['selector'].add('/{userpage:segment}', GET=user_page)

        new_serializer = [
            'tiddlywebplugins.hoster.serialization', 'text/html; charset=UTF-8'
        ]
        config['serializers']['text/html'] = new_serializer
    else:

        @make_command()
        def upstore(args):
            """Update the store structure."""
            from tiddlywebplugins.hoster.instance import store_structure
            from tiddlywebplugins.instancer import Instance
            from tiddlyweb.config import config
            instance = Instance('.', config)
            instance._init_store(store_structure)
Пример #4
0
def init(config):
    import tiddlywebwiki
    import tiddlywebplugins.register
    import tiddlywebplugins.wimporter
    import tiddlywebplugins.logout
    import tiddlywebplugins.form

    tiddlywebwiki.init(config)
    tiddlywebplugins.register.init(config)
    tiddlywebplugins.wimporter.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.form.init(config)

    # XXX this clobbers?
    config["instance_tiddlers"] = instance_tiddlers

    if "selector" in config:
        replace_handler(config["selector"], "/", dict(GET=front))
        config["selector"].add("/help", GET=help_page)
        config["selector"].add("/login", GET=login)
        config["selector"].add("/uploader", GET=uploader)
        config["selector"].add("/formeditor", GET=get_tiddler_edit, POST=post_tiddler_edit)
        config["selector"].add("/addemail", POST=add_email)
        config["selector"].add("/follow", POST=add_friend)
        config["selector"].add("/members", GET=members_list)
        config["selector"].add("/bagfavor", POST=bag_favor)
        config["selector"].add("/recipefavor", POST=recipe_favor)
        config["selector"].add("/bagpolicy", POST=entity_policy)
        config["selector"].add("/recipepolicy", POST=entity_policy)
        config["selector"].add("/createrecipe", GET=get_createrecipe, POST=post_createrecipe)
        config["selector"].add("/createbag", GET=get_createbag, POST=post_createbag)
        config["selector"].add("/feedbag[.{format}]", GET=public_stuff)
        config["selector"].add("/home", GET=get_home)
        # THE FOLLOWING MUST COME LAST
        config["selector"].add("/{userpage:segment}", GET=user_page)

        presenter_index = config["server_response_filters"].index(HTMLPresenter)
        config["server_response_filters"][presenter_index] = PrettyPresenter
        # XXX: disable the specialized extractor for now. The roles it
        # adds are not used (yet).
        # simple_cookie_index = config['extractors'].index('simple_cookie')
        # config['extractors'][simple_cookie_index] = 'tiddlywebplugins.hoster.extractor'

        new_serializer = ["tiddlywebplugins.hoster.serialization", "text/html; charset=UTF-8"]
        config["serializers"]["text/html"] = new_serializer
    else:

        @make_command()
        def upstore(args):
            """Update the store structure."""
            from tiddlywebplugins.hoster.instance import store_structure
            from tiddlywebplugins.instancer import Instance
            from tiddlyweb.config import config

            instance = Instance(".", config)
            instance._init_store(store_structure)
Пример #5
0
def init(config):
    import tiddlywebwiki
    import tiddlywebplugins.register
    import tiddlywebplugins.wimporter
    import tiddlywebplugins.logout
    import tiddlywebplugins.form
    tiddlywebwiki.init(config)
    tiddlywebplugins.register.init(config)
    tiddlywebplugins.wimporter.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.form.init(config)
    
    # XXX this clobbers?
    config['instance_tiddlers'] = instance_tiddlers

    if 'selector' in config:
        replace_handler(config['selector'], '/', dict(GET=front))
        config['selector'].add('/help', GET=help_page)
        config['selector'].add('/login', GET=login)
        config['selector'].add('/uploader', GET=uploader)
        config['selector'].add('/formeditor', GET=get_tiddler_edit,
                POST=post_tiddler_edit)
        config['selector'].add('/addemail', POST=add_email)
        config['selector'].add('/follow', POST=add_friend)
        config['selector'].add('/members', GET=members_list)
        config['selector'].add('/bagfavor', POST=bag_favor)
        config['selector'].add('/recipefavor', POST=recipe_favor)
        config['selector'].add('/bagpolicy', POST=entity_policy)
        config['selector'].add('/recipepolicy', POST=entity_policy)
        config['selector'].add('/createrecipe', GET=get_createrecipe,
                POST=post_createrecipe)
        config['selector'].add('/createbag', GET=get_createbag,
                POST=post_createbag)
        config['selector'].add('/feedbag[.{format}]', GET=public_stuff)
        config['selector'].add('/home', GET=get_home)
        # THE FOLLOWING MUST COME LAST
        config['selector'].add('/{userpage:segment}', GET=user_page)

        # XXX: disable the specialized extractor for now. The roles it
        # adds are not used (yet).
        #simple_cookie_index = config['extractors'].index('simple_cookie')
        #config['extractors'][simple_cookie_index] = 'tiddlywebplugins.hoster.extractor'

        new_serializer = ['tiddlywebplugins.hoster.serialization', 'text/html; charset=UTF-8']
        config['serializers']['text/html'] = new_serializer
    else:
        @make_command()
        def upstore(args):
            """Update the store structure."""
            from tiddlywebplugins.hoster.instance import store_structure
            from tiddlywebplugins.instancer import Instance
            from tiddlyweb.config import config
            instance = Instance('.', config)
            instance._init_store(store_structure)
Пример #6
0
def init(config):
    import tiddlywebwiki
    import tiddlywebplugins.register
    import tiddlywebplugins.wimporter
    import tiddlywebplugins.logout
    import tiddlywebplugins.form

    merge_config(config, hoster_config)

    tiddlywebwiki.init(config)
    tiddlywebplugins.register.init(config)
    tiddlywebplugins.wimporter.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.form.init(config)

    merge_config(config, hoster_config)

    if 'selector' in config:
        remove_handler(config['selector'], '/{recipe_name:segment}')
        replace_handler(config['selector'], '/', dict(GET=front))
        config['selector'].add('/help', GET=help_page)
        config['selector'].add('/login', GET=login)
        config['selector'].add('/uploader', GET=uploader)
        config['selector'].add('/formeditor', GET=get_tiddler_edit,
                POST=post_tiddler_edit)
        config['selector'].add('/addemail', POST=add_email)
        config['selector'].add('/follow', POST=add_friend)
        config['selector'].add('/members', GET=members_list)
        config['selector'].add('/bagfavor', POST=bag_favor)
        config['selector'].add('/recipefavor', POST=recipe_favor)
        config['selector'].add('/bagpolicy', POST=entity_policy)
        config['selector'].add('/recipepolicy', POST=entity_policy)
        config['selector'].add('/createrecipe', GET=get_createrecipe,
                POST=post_createrecipe)
        config['selector'].add('/createbag', GET=get_createbag,
                POST=post_createbag)
        config['selector'].add('/feedbag[.{format}]', GET=public_stuff)
        config['selector'].add('/home', GET=get_home)
        # THE FOLLOWING MUST COME LAST
        config['selector'].add('/{userpage:segment}', GET=user_page)

        new_serializer = ['tiddlywebplugins.hoster.serialization',
                'text/html; charset=UTF-8']
        config['serializers']['text/html'] = new_serializer
    else:
        @make_command()
        def upstore(args):
            """Update the store structure."""
            from tiddlywebplugins.hoster.instance import store_structure
            from tiddlywebplugins.instancer import Instance
            from tiddlyweb.config import config
            instance = Instance('.', config)
            instance._init_store(store_structure)
Пример #7
0
def init(config):
    import tiddlywebwiki
    import tiddlywebplugins.register
    import tiddlywebplugins.wimporter
    tiddlywebwiki.init(config)
    tiddlywebplugins.register.init(config)
    tiddlywebplugins.wimporter.init(config)
    
    # XXX this clobbers?
    config['instance_tiddlers'] = instance_tiddlers

    if config['selector']:
        replace_handler(config['selector'], '/', dict(GET=front))
        config['selector'].add('/help', GET=help_page)
        config['selector'].add('/formeditor', GET=get_profiler, POST=post_profile)
        config['selector'].add('/addemail', POST=add_email)
        config['selector'].add('/follow', POST=add_friend)
        config['selector'].add('/logout', POST=logout)
        config['selector'].add('/members', GET=members_list)
        config['selector'].add('/bagfavor', POST=bag_favor)
        config['selector'].add('/bagpolicy', POST=bag_policy)
        config['selector'].add('/createrecipe', GET=get_createrecipe,
                POST=post_createrecipe)
        config['selector'].add('/createbag', GET=get_createbag,
                POST=post_createbag)
        # THE FOLLOWING MUST COME LAST
        config['selector'].add('/{userpage:segment}', GET=user_page)

        presenter_index = config['server_response_filters'].index(HTMLPresenter)
        config['server_response_filters'][presenter_index] = PrettyPresenter
        # XXX: disable the specialized extractor for now. The roles it
        # adds are not used (yet).
        #simple_cookie_index = config['extractors'].index('simple_cookie')
        #config['extractors'][simple_cookie_index] = 'tiddlywebplugins.hoster.extractor'

        new_serializer = ['tiddlywebplugins.hoster.serialization', 'text/html; charset=UTF-8']
        config['serializers']['text/html'] = new_serializer
        config['serializers']['default'] = new_serializer
    else:
        @make_command()
        def upstore(args):
            """Update the store structure."""
            from tiddlywebplugins.hoster.instance import store_structure
            from tiddlywebplugins.instancer import Instance
            from tiddlyweb.config import config
            instance = Instance('.', config)
            instance._init_store(store_structure)
Пример #8
0
def init(config):
    """
    merge custom config with config
    """
    import tiddlywebwiki
    tiddlywebwiki.init(config)
    import tiddlywebplugins.virtualhosting
    # calling init on virtualhosting not required

    merge_config(config, space_config) # XXX: we probably don't wanna do this here

    if 'selector' in config:
        replace_handler(config['selector'], '/', dict(GET=home))
        config['selector'].add('/dashboard[/]', GET=dashboard)
        config['selector'].add('/spaces[/]', POST=post_space_handler)
        config['selector'].add('/users', GET=list_users, POST=post_user)
        config['selector'].add('/users/{usersign}', GET=get_user, PUT=put_user)
Пример #9
0
def setup_module(module):
    tiddlywebwiki.init(config)
    tiddlywebwiki.manage.init(config)
    try:
        rmtree(instance_dir)
    except:
        pass

    instance_tiddlers = config['instance_tiddlers']
    for bag, uris in instance_tiddlers.items():
        # ensure that HTTP URLs are not used -- XXX: this is a temporary workaround until we have proper tests
        for uri in uris:
            if uri.startswith('http'):
                raise ValueError('must not use HTTP URLs; use cacher for local copies')
        # adjust relative paths to account for instancer's chdir operation -- XXX: obsolete?
        instance_tiddlers[bag] = [
            uri.replace('file:./', 'file:../') for uri in uris
            ]
Пример #10
0
def init(config):
    """
    Establish required plugins and HTTP routes.
    """
    import tiddlywebwiki
    import tiddlywebplugins.logout
    import tiddlywebplugins.virtualhosting  # calling init not required
    import tiddlywebplugins.magicuser
    import tiddlywebplugins.socialusers
    import tiddlywebplugins.mselect
    import tiddlywebplugins.oom
    import tiddlywebplugins.cookiedomain
    import tiddlywebplugins.tiddlyspace.validator
    import tiddlywebplugins.prettyerror
    import tiddlywebplugins.pathinfohack
    import tiddlywebplugins.hashmaker
    import tiddlywebplugins.form
    import tiddlywebplugins.reflector
    import tiddlywebplugins.privateer
    import tiddlywebplugins.relativetime
    import tiddlywebplugins.jsonp

    # Only load and run dispatcher if we are specifically configured
    # to use it.
    if config.get('use_dispatcher', False):
        import tiddlywebplugins.dispatcher
        import tiddlywebplugins.dispatcher.listener

    establish_commands(config)

    merge_config(config, space_config)

    tiddlywebwiki.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.magicuser.init(config)
    tiddlywebplugins.socialusers.init(config)
    tiddlywebplugins.mselect.init(config)
    tiddlywebplugins.oom.init(config)
    tiddlywebplugins.cookiedomain.init(config)
    tiddlywebplugins.prettyerror.init(config)
    tiddlywebplugins.pathinfohack.init(config)
    tiddlywebplugins.hashmaker.init(config)
    tiddlywebplugins.form.init(config)
    tiddlywebplugins.reflector.init(config)
    tiddlywebplugins.privateer.init(config)
    tiddlywebplugins.jsonp.init(config)

    if config.get('use_dispatcher', False):
        tiddlywebplugins.dispatcher.init(config)
        tiddlywebplugins.dispatcher.listener.init(config)

    # XXX: The following is required to work around issues with twp.instancer.
    # Without this, config settings from tiddlywebwiki take precedence.
    config['serializers']['text/x-tiddlywiki'] = space_config[
            'serializers']['text/x-tiddlywiki']
    # This only fixes 'twanager update', instance creation still does not have
    # the right information, thus requiring a twanager update after instance
    # creation. Presumably the instance script needs to do something similar.
    config['instance_tiddlers'] = get_tiddler_locations(store_contents,
            'tiddlywebplugins.tiddlyspace')

    # inject lazy serialization information
    config['extension_types'].update({'lwiki': 'text/x-ltiddlywiki'})
    config['serializers'].update({'text/x-ltiddlywiki':
        ['tiddlywebplugins.tiddlyspace.betalazyserialization',
            'text/html; charset=UTF-8']})

    if 'selector' in config:  # system plugin
        establish_www(config)

    # update html serialization
    new_serializer = ['tiddlywebplugins.tiddlyspace.htmlserialization',
            'text/html; charset=UTF-8']
    config['serializers']['text/html'] = new_serializer
    config['serializers']['default'] = new_serializer
Пример #11
0
def init(config):
    """
    Establish required plugins and HTTP routes.
    """
    import tiddlywebwiki
    import tiddlywebplugins.logout
    import tiddlywebplugins.virtualhosting  # calling init not required
    import tiddlywebplugins.magicuser
    import tiddlywebplugins.socialusers
    import tiddlywebplugins.mselect
    import tiddlywebplugins.oom
    import tiddlywebplugins.cookiedomain
    import tiddlywebplugins.tiddlyspace.validator
    import tiddlywebplugins.prettyerror
    import tiddlywebplugins.pathinfohack
    import tiddlywebplugins.hashmaker
    import tiddlywebplugins.form
    import tiddlywebplugins.reflector
    import tiddlywebplugins.privateer
    import tiddlywebplugins.relativetime
    import tiddlywebplugins.jsonp

    # Only load and run dispatcher if we are specifically configured
    # to use it.
    if config.get('use_dispatcher', False):
        import tiddlywebplugins.dispatcher
        import tiddlywebplugins.dispatcher.listener

    @make_command()
    def addmember(args):
        """Add a member to a space: <space name> <user name>"""
        store = get_store(config)
        space_name, username = args
        change_space_member(store, space_name, add=username)
        return True

    @make_command()
    def delmember(args):
        """Delete a member from a space: <space name> <user name>"""
        store = get_store(config)
        space_name, username = args
        change_space_member(store, space_name, remove=username)
        return True

    @make_command()
    def deltiddler(args):
        """Delete a tiddler from a bag: <bag> <title>"""
        from tiddlyweb.model.tiddler import Tiddler
        from tiddlyweb.store import NoTiddlerError
        from tiddlyweb.util import std_error_message
        bag, title = args
        prompt = 'deleting tiddler %s from bag %s - enter "yes" to confirm' % (
            title, bag)
        if raw_input('%s\n' % prompt) == 'yes':
            store = get_store(config)
            tiddler = Tiddler(title, bag)
            try:
                store.delete(tiddler)
            except NoTiddlerError:
                std_error_message('error deleting tiddler %s from bag %s: %s' %
                                  (title, bag, 'no such tiddler'))
            return True
        else:
            std_error_message('aborted')
            return False

    merge_config(config, space_config)

    tiddlywebwiki.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.magicuser.init(config)
    tiddlywebplugins.socialusers.init(config)
    tiddlywebplugins.mselect.init(config)
    tiddlywebplugins.oom.init(config)
    tiddlywebplugins.cookiedomain.init(config)
    tiddlywebplugins.prettyerror.init(config)
    tiddlywebplugins.pathinfohack.init(config)
    tiddlywebplugins.hashmaker.init(config)
    tiddlywebplugins.form.init(config)
    tiddlywebplugins.reflector.init(config)
    tiddlywebplugins.privateer.init(config)
    tiddlywebplugins.jsonp.init(config)

    if config.get('use_dispatcher', False):
        tiddlywebplugins.dispatcher.init(config)
        tiddlywebplugins.dispatcher.listener.init(config)

    # XXX: The following is required to work around issues with twp.instancer.
    # Without this, config settings from tiddlywebwiki take precedence.
    config['serializers']['text/x-tiddlywiki'] = space_config['serializers'][
        'text/x-tiddlywiki']
    # This only fixes 'twanager update', instance creation still does not have
    # the right information, thus requiring a twanager update after instance
    # creation. Presumably the instance script needs to do something similar.
    config['instance_tiddlers'] = get_tiddler_locations(
        store_contents, 'tiddlywebplugins.tiddlyspace')

    # inject lazy serialization information
    config['extension_types'].update({'lwiki': 'text/x-ltiddlywiki'})
    config['serializers'].update({
        'text/x-ltiddlywiki': [
            'tiddlywebplugins.tiddlyspace.betalazyserialization',
            'text/html; charset=UTF-8'
        ]
    })

    if 'selector' in config:  # system plugin
        replace_handler(config['selector'], '/', dict(GET=home))
        config['selector'].add('/_safe', GET=safe_mode, POST=safe_mode)
        add_spaces_routes(config['selector'])
        add_profile_routes(config['selector'])
        config['selector'].add('/{tiddler_name:segment}', GET=friendly_uri)
        config['selector'].add('/users/{username}/identities',
                               GET=get_identities)

        if ControlView not in config['server_request_filters']:
            config['server_request_filters'].insert(
                config['server_request_filters'].index(UserExtract) + 1,
                ControlView)

        if DropPrivs not in config['server_request_filters']:
            config['server_request_filters'].insert(
                config['server_request_filters'].index(ControlView) + 1,
                DropPrivs)

        if CSRFProtector not in config['server_request_filters']:
            config['server_request_filters'].append(CSRFProtector)

        if AllowOrigin not in config['server_response_filters']:
            config['server_response_filters'].insert(
                config['server_response_filters'].index(PrettyHTTPExceptor) +
                1, AllowOrigin)

        new_serializer = [
            'tiddlywebplugins.tiddlyspace.htmlserialization',
            'text/html; charset=UTF-8'
        ]
        config['serializers']['text/html'] = new_serializer
        config['serializers']['default'] = new_serializer
def setup_module(module):
    tiddlywebwiki.init(config)
    module.serializer = Serializer('tiddlywebplugins.atom.feed',
            environ={'tiddlyweb.config': config})
Пример #13
0
def init(config):
    """
    Establish required plugins and HTTP routes.
    """
    import tiddlywebwiki
    import tiddlywebplugins.logout
    import tiddlywebplugins.virtualhosting  # calling init not required
    import tiddlywebplugins.magicuser
    import tiddlywebplugins.socialusers
    import tiddlywebplugins.mselect
    import tiddlywebplugins.oom
    import tiddlywebplugins.cookiedomain
    import tiddlywebplugins.tiddlyspace.validator
    import tiddlywebplugins.prettyerror
    import tiddlywebplugins.pathinfohack
    import tiddlywebplugins.hashmaker
    import tiddlywebplugins.form
    import tiddlywebplugins.reflector
    import tiddlywebplugins.lazy
    import tiddlywebplugins.privateer
    import tiddlywebplugins.relativetime
    import tiddlywebplugins.jsonp

    @make_command()
    def addmember(args):
        """Add a member to a space: <space name> <user name>"""
        store = get_store(config)
        space_name, username = args
        change_space_member(store, space_name, add=username)
        return True

    @make_command()
    def delmember(args):
        """Delete a member from a space: <space name> <user name>"""
        store = get_store(config)
        space_name, username = args
        change_space_member(store, space_name, remove=username)
        return True

    @make_command()
    def deltiddler(args):
        """Delete a tiddler from a bag: <bag> <title>"""
        from tiddlyweb.model.tiddler import Tiddler
        from tiddlyweb.store import NoTiddlerError
        from tiddlyweb.util import std_error_message
        bag, title = args
        prompt = 'deleting tiddler %s from bag %s - enter "yes" to confirm' % (
                title, bag)
        if raw_input('%s\n' % prompt) == 'yes':
            store = get_store(config)
            tiddler = Tiddler(title, bag)
            try:
                store.delete(tiddler)
            except NoTiddlerError:
                std_error_message(
                        'error deleting tiddler %s from bag %s: %s' % (
                            title, bag, 'no such tiddler'))
            return True
        else:
            std_error_message('aborted')
            return False

    merge_config(config, space_config)

    tiddlywebwiki.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.magicuser.init(config)
    tiddlywebplugins.socialusers.init(config)
    tiddlywebplugins.mselect.init(config)
    tiddlywebplugins.oom.init(config)
    tiddlywebplugins.cookiedomain.init(config)
    tiddlywebplugins.prettyerror.init(config)
    tiddlywebplugins.pathinfohack.init(config)
    tiddlywebplugins.hashmaker.init(config)
    tiddlywebplugins.form.init(config)
    tiddlywebplugins.reflector.init(config)
    tiddlywebplugins.lazy.init(config)
    tiddlywebplugins.privateer.init(config)
    tiddlywebplugins.jsonp.init(config)

    # XXX: The following is required to work around issues with twp.instancer.
    # Without this, config settings from tiddlywebwiki take precedence.
    config['serializers']['text/x-tiddlywiki'] = space_config[
            'serializers']['text/x-tiddlywiki']
    # This only fixes 'twanager update', instance creation still does not have
    # the right information, thus requiring a twanager update after instance
    # creation. Presumably the instance script needs to do something similar.
    config['instance_tiddlers'] = get_tiddler_locations(store_contents,
            'tiddlywebplugins.tiddlyspace')

    if 'selector' in config:  # system plugin
        replace_handler(config['selector'], '/', dict(GET=home))
        config['selector'].add('/_safe', GET=safe_mode, POST=safe_mode)
        add_spaces_routes(config['selector'])
        config['selector'].add('/{tiddler_name:segment}', GET=friendly_uri)
        config['selector'].add('/users/{username}/identities',
                GET=get_identities)

        if ControlView not in config['server_request_filters']:
            config['server_request_filters'].insert(
                    config['server_request_filters'].
                    index(UserExtract) + 1, ControlView)

        if DropPrivs not in config['server_request_filters']:
            config['server_request_filters'].insert(
                    config['server_request_filters'].
                    index(ControlView) + 1, DropPrivs)

        if CSRFProtector not in config['server_request_filters']:
            config['server_request_filters'].append(CSRFProtector)

        if AllowOrigin not in config['server_response_filters']:
            config['server_response_filters'].insert(
                    config['server_response_filters'].
                    index(PrettyHTTPExceptor) + 1, AllowOrigin)

        new_serializer = ['tiddlywebplugins.tiddlyspace.htmlserialization',
                'text/html; charset=UTF-8']
        config['serializers']['text/html'] = new_serializer
        config['serializers']['default'] = new_serializer
def setup_module(module):
    tiddlywebwiki.init(config)
    module.serializer = Serializer('tiddlywebplugins.atom.feed',
                                   environ={'tiddlyweb.config': config})
Пример #15
0
def setup_module(module):
    tiddlywebwiki.init(config)
    try:
        rmtree(instance_dir)
    except:
        pass
Пример #16
0
def init(config):
    import tiddlywebwiki
    import tiddlywebplugins.virtualhosting # calling init not required

    merge_config(config, space_config)
    tiddlywebwiki.init(config)
Пример #17
0
def init_plugin(config):
    import tiddlywebplugins.whoosher
    import tiddlywebwiki
    import tiddlywebplugins.logout
    import tiddlywebplugins.virtualhosting  # calling init not required
    import tiddlywebplugins.magicuser
    import tiddlywebplugins.socialusers
    import tiddlywebplugins.mselect
    import tiddlywebplugins.oom
    import tiddlywebplugins.cookiedomain
    import tiddlywebplugins.tiddlyspace.validator
    import tiddlywebplugins.prettyerror
    import tiddlywebplugins.hashmaker
    import tiddlywebplugins.form
    import tiddlywebplugins.reflector
    import tiddlywebplugins.privateer
    import tiddlywebplugins.relativetime
    import tiddlywebplugins.jsonp

    # Only load and run dispatcher if we are specifically configured
    # to use it.
    if config.get('use_dispatcher', False):
        import tiddlywebplugins.dispatcher
        import tiddlywebplugins.dispatcher.listener

    establish_commands(config)

    merge_config(config, space_config)

    if config.get('tiddlyspace.enable_profile', False):
        from werkzeug.contrib.profiler import ProfilerMiddleware
        config['server_request_filters'].insert(0, ProfilerMiddleware)

    tiddlywebplugins.whoosher.init(config)
    tiddlywebwiki.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.magicuser.init(config)
    tiddlywebplugins.socialusers.init(config)
    tiddlywebplugins.mselect.init(config)
    tiddlywebplugins.oom.init(config)
    tiddlywebplugins.cookiedomain.init(config)
    tiddlywebplugins.prettyerror.init(config)
    tiddlywebplugins.hashmaker.init(config)
    tiddlywebplugins.form.init(config)
    tiddlywebplugins.reflector.init(config)
    tiddlywebplugins.privateer.init(config)
    tiddlywebplugins.jsonp.init(config)

    if config.get('use_dispatcher', False):
        tiddlywebplugins.dispatcher.init(config)
        tiddlywebplugins.dispatcher.listener.init(config)

    # reset config _again_ to deal with any adjustments from the
    # above init calls
    merge_config(config, space_config)

    # When tiddlyspace.frontpage_installed is True, don't update
    # the frontpage_public bag, thus not overwriting what's there.
    if config.get('tiddlyspace.frontpage_installed', False):
        config['pkgstore.skip_bags'] = ['frontpage_public']

    if 'selector' in config:  # system plugin
        # remove friendlywiki
        remove_handler(config['selector'], '/{recipe_name:segment}')
        establish_www(config)

    # update html serialization
    new_serializer = ['tiddlywebplugins.tiddlyspace.htmlserialization',
            'text/html; charset=UTF-8']
    config['serializers']['text/html'] = new_serializer
Пример #18
0
def init_plugin(config):
    import tiddlywebwiki
    import tiddlywebplugins.logout
    import tiddlywebplugins.virtualhosting  # calling init not required
    import tiddlywebplugins.magicuser
    import tiddlywebplugins.socialusers
    import tiddlywebplugins.mselect
    import tiddlywebplugins.oom
    import tiddlywebplugins.cookiedomain
    import tiddlywebplugins.tiddlyspace.validator
    import tiddlywebplugins.prettyerror
    import tiddlywebplugins.pathinfohack
    import tiddlywebplugins.hashmaker
    import tiddlywebplugins.form
    import tiddlywebplugins.reflector
    import tiddlywebplugins.privateer
    import tiddlywebplugins.relativetime
    import tiddlywebplugins.jsonp

    # Only load and run dispatcher if we are specifically configured
    # to use it.
    if config.get('use_dispatcher', False):
        import tiddlywebplugins.dispatcher
        import tiddlywebplugins.dispatcher.listener

    establish_commands(config)

    merge_config(config, space_config)

    if config.get('tiddlyspace.enable_profile', False):
        from werkzeug.contrib.profiler import ProfilerMiddleware
        config['server_request_filters'].insert(0, ProfilerMiddleware)

    tiddlywebwiki.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.magicuser.init(config)
    tiddlywebplugins.socialusers.init(config)
    tiddlywebplugins.mselect.init(config)
    tiddlywebplugins.oom.init(config)
    tiddlywebplugins.cookiedomain.init(config)
    tiddlywebplugins.prettyerror.init(config)
    tiddlywebplugins.pathinfohack.init(config)
    tiddlywebplugins.hashmaker.init(config)
    tiddlywebplugins.form.init(config)
    tiddlywebplugins.reflector.init(config)
    tiddlywebplugins.privateer.init(config)
    tiddlywebplugins.jsonp.init(config)

    if config.get('use_dispatcher', False):
        tiddlywebplugins.dispatcher.init(config)
        tiddlywebplugins.dispatcher.listener.init(config)

    # XXX: The following is required to work around issues with twp.instancer.
    # Without this, config settings from tiddlywebwiki take precedence.
    config['serializers']['text/x-tiddlywiki'] = space_config[
            'serializers']['text/x-tiddlywiki']
    # This only fixes 'twanager update', instance creation still does not have
    # the right information, thus requiring a twanager update after instance
    # creation. Presumably the instance script needs to do something similar.
    config['instance_tiddlers'] = get_tiddler_locations(store_contents,
            'tiddlywebplugins.tiddlyspace')

    # When tiddlyspace.frontpage_installed is True, don't update
    # the frontpage_public bag, thus not overwriting what's there.
    if config.get('tiddlyspace.frontpage_installed', False):
        config['instance_tiddlers']['frontpage_public'] = []

    if 'selector' in config:  # system plugin
        establish_www(config)

    # update html serialization
    new_serializer = ['tiddlywebplugins.tiddlyspace.htmlserialization',
            'text/html; charset=UTF-8']
    config['serializers']['text/html'] = new_serializer
Пример #19
0
def init_plugin(config):
    import tiddlywebwiki
    import tiddlywebplugins.logout
    import tiddlywebplugins.virtualhosting  # calling init not required
    import tiddlywebplugins.magicuser
    import tiddlywebplugins.socialusers
    import tiddlywebplugins.mselect
    import tiddlywebplugins.oom
    import tiddlywebplugins.cookiedomain
    import tiddlywebplugins.tiddlyspace.validator
    import tiddlywebplugins.prettyerror
    import tiddlywebplugins.pathinfohack
    import tiddlywebplugins.hashmaker
    import tiddlywebplugins.form
    import tiddlywebplugins.reflector
    import tiddlywebplugins.privateer
    import tiddlywebplugins.relativetime
    import tiddlywebplugins.jsonp

    # Only load and run dispatcher if we are specifically configured
    # to use it.
    if config.get('use_dispatcher', False):
        import tiddlywebplugins.dispatcher
        import tiddlywebplugins.dispatcher.listener

    establish_commands(config)

    merge_config(config, space_config)

    if config.get('tiddlyspace.enable_profile', False):
        from werkzeug.contrib.profiler import ProfilerMiddleware
        config['server_request_filters'].insert(0, ProfilerMiddleware)

    tiddlywebwiki.init(config)
    tiddlywebplugins.logout.init(config)
    tiddlywebplugins.magicuser.init(config)
    tiddlywebplugins.socialusers.init(config)
    tiddlywebplugins.mselect.init(config)
    tiddlywebplugins.oom.init(config)
    tiddlywebplugins.cookiedomain.init(config)
    tiddlywebplugins.prettyerror.init(config)
    tiddlywebplugins.pathinfohack.init(config)
    tiddlywebplugins.hashmaker.init(config)
    tiddlywebplugins.form.init(config)
    tiddlywebplugins.reflector.init(config)
    tiddlywebplugins.privateer.init(config)
    tiddlywebplugins.jsonp.init(config)

    if config.get('use_dispatcher', False):
        tiddlywebplugins.dispatcher.init(config)
        tiddlywebplugins.dispatcher.listener.init(config)

    # XXX: The following is required to work around issues with twp.instancer.
    # Without this, config settings from tiddlywebwiki take precedence.
    config['serializers']['text/x-tiddlywiki'] = space_config['serializers'][
        'text/x-tiddlywiki']
    # This only fixes 'twanager update', instance creation still does not have
    # the right information, thus requiring a twanager update after instance
    # creation. Presumably the instance script needs to do something similar.
    config['instance_tiddlers'] = get_tiddler_locations(
        store_contents, 'tiddlywebplugins.tiddlyspace')

    # inject lazy serialization information
    config['extension_types'].update({'lwiki': 'text/x-ltiddlywiki'})
    config['serializers'].update({
        'text/x-ltiddlywiki': [
            'tiddlywebplugins.tiddlyspace.betalazyserialization',
            'text/html; charset=UTF-8'
        ]
    })

    if 'selector' in config:  # system plugin
        establish_www(config)

    # update html serialization
    new_serializer = [
        'tiddlywebplugins.tiddlyspace.htmlserialization',
        'text/html; charset=UTF-8'
    ]
    config['serializers']['text/html'] = new_serializer