Exemplo n.º 1
0
def init_app(global_config,
             settings,
             prefix='/mgr',
             include=None,
             include_tags=None):

    # global, shared settings

    temp_path = settings['genaf.temp_directory']
    set_temp_path(temp_path)

    fsomount(TEMP_TOOLS, get_temp_path('', TEMP_TOOLS))
    set_func_userid(generic_userid_func)

    # preparing for multiprocessing
    #init_queue(settings)

    # init taks cache, which provides a rudimentary caching for result coming
    # from worker process.
    # note that this mechanism is ony suitable for single wsgi worker - multiple
    # proc workers
    init_taskcache(settings)
    init_taskqueue(settings)

    # attach rhombus to /mgr url, include custom configuration
    config = rhombus_init_app(global_config,
                              settings,
                              prefix,
                              include=include,
                              include_tags=include_tags)

    return config
Exemplo n.º 2
0
def setup_settings( args ):

    configfile = args.config or os.environ.get(ENVIRON)

    if not configfile:
        cexit('need -c or --config option, or set %s environment' % ENVIRON)

    setup_logging( configfile )
    settings = get_appsettings( configfile )

    set_func_userid(userid_func)
    user = args.user or os.environ.get(USER) or None

    return settings
Exemplo n.º 3
0
def init_app( global_config, settings, prefix = '/mgr' ):

    # global, shared settings

    temp_path = settings['genaf.temp_directory']
    set_temp_path( temp_path )

    fsomount(TEMP_TOOLS, get_temp_path('', TEMP_TOOLS))

    set_func_userid( generic_userid_func )

    # preparing for multiprocessing
    init_queue(settings)

    config = rhombus_init_app( global_config, settings, prefix=prefix )

    return config
Exemplo n.º 4
0
def includeme( config ):
    """ this configuration must be included as last order
    """

    # CMSFix configuration

    set_func_userid( get_userid_func )

    config.add_static_view('static', 'static', cache_max_age=3600)

    config.add_route('home', '/')
    config.add_view('cmsfix.views.home.index', route_name='home')

    config.add_route('login', '/login')
    config.add_view('cmsfix.views.home.login', route_name='login')

    config.add_route('logout', '/logout')
    config.add_view('cmsfix.views.home.logout', route_name='logout')

    config.add_route('search', '/search')
    config.add_view('cmsfix.views.search.index', route_name='search')

    config.add_route('tag-lookup', '/tag-lookup')
    config.add_view('cmsfix.views.node.tag_lookup', route_name='tag-lookup', renderer='json')

    config.add_route('filenode-upload', '/fileupload/{sesskey:.*}')
    config.add_view('cmsfix.views.node.filenode.fileupload', route_name='filenode-upload', renderer='json')

    config.add_route('node-view', '{path:.*}@@view')
    config.add_view('cmsfix.views.node.view', route_name='node-view')

    config.add_route('node-content', '{path:.*}@@content')
    config.add_view('cmsfix.views.node.content', route_name='node-content')

    config.add_route('node-info', '{path:.*}@@info')
    config.add_view('cmsfix.views.node.info', route_name='node-info')

    config.add_route('node-manage', '{path:.*}@@manage')
    config.add_view('cmsfix.views.node.manage', route_name='node-manage')

    config.add_route('node-add', '{path:.*}@@add')
    config.add_view('cmsfix.views.node.add', route_name='node-add')

    config.add_route('node-edit', '{path:.*}@@edit')
    config.add_view('cmsfix.views.node.edit', route_name='node-edit')

    config.add_route('node-action', '{path:.*}@@action')
    config.add_view('cmsfix.views.node.action', route_name='node-action')

    config.add_route('node-index', '{path:.*}')
    config.add_view('cmsfix.views.node.index', route_name='node-index')

    register_module(Node, node_mod)
    register_module(PageNode, pagenode_mod)
    register_module(FileNode, filenode_mod)
    register_module(JournalNode, journalnode_mod)
    register_module(JournalItemNode, journalitemnode_mod)

    config.override_asset('rhombus:templates/base.mako', 'cmsfix:templates/base.mako')
    config.override_asset('rhombus:templates/plainbase.mako', 'cmsfix:templates/plainbase.mako')

    # set index service
    set_index_service(IndexService(config.registry.settings['cmsfix.whoosh.path']))