from ConfigParser import ConfigParser

from pyramid.config import Configurator

import pkg_resources


def main(global_config, **settings):

    cp = ConfigParser()
    cp.readfp(pkg_resources.resource_stream('springboard', 'defaults.ini'))
    defaults = dict(cp.items('springboard:pyramid'))
    filters = [
        'recent_pages = springboard_iogt.filters:recent_pages',
        'category_dict = springboard_iogt.filters:category_dict',
        'content_section = springboard_iogt.filters:content_section'
    ]
    defaults['jinja2.filters'] += '\n%s' % '\n'.join(filters)
    defaults.update(settings)

    config = Configurator(settings=defaults)

    # add to springboard routes
    config.add_route('content_section', '/section/{slug}/')
    config.add_route('personae', '/persona/')
    config.add_route('skip_persona_selection', '/persona/skip/')
    config.add_route('select_persona', '/persona/{slug}/')
    config.add_route('about', '/about/')
    config.add_tween('springboard_iogt.views.persona_tween_factory')
    config.scan('.views')
    config.scan('.events')

    config.include('springboard.config')
    config.configure_celery(global_config['__file__'])
    config.override_asset(
        to_override='springboard:templates/',
        override_with='springboard_iogt:templates/')
    config.add_static_view(
        'static', 'springboard_iogt:static', cache_max_age=3600)

    return config.make_wsgi_app()

from ConfigParser import ConfigParser

from pyramid.config import Configurator

import pkg_resources


def main(global_config, **settings):

    cp = ConfigParser()
    cp.readfp(pkg_resources.resource_stream('springboard', 'defaults.ini'))
    defaults = dict(cp.items('springboard:pyramid'))
    filters = [
        'recent_pages = springboard_iogt.filters:recent_pages',
        'category_dict = springboard_iogt.filters:category_dict',
        'content_section = springboard_iogt.filters:content_section'
    ]
    defaults['jinja2.filters'] += '\n%s' % '\n'.join(filters)
    defaults.update(settings)

    config = Configurator(settings=defaults)

    # add to springboard routes
    config.add_route('content_section', '/section/{slug}/')
    config.add_route('personae', '/persona/')
    config.add_route('skip_persona_selection', '/persona/skip/')
    config.add_route('select_persona', '/persona/{slug}/')
    config.add_route('about', '/about/')
    config.add_tween('springboard_iogt.views.persona_tween_factory')
    config.scan('.views')
    config.scan('.events')

    config.include('springboard.config')
    config.configure_celery(global_config['__file__'])
    config.override_asset(
        to_override='springboard:templates/',
        override_with='springboard_iogt:templates/')
    config.add_static_view(
        'static', 'springboard_iogt:static', cache_max_age=3600)
    config.add_translation_dirs('springboard_iogt:locale/')

    return config.make_wsgi_app()

set up translation dir