def includeme(config):
    """
    Include `crabpy_pyramid` in this `Pyramid` application.

    :param pyramid.config.Configurator config: A Pyramid configurator.
    """

    settings = _parse_settings(config.registry.settings)
    base_settings = _get_proxy_settings(settings)

    # http caching tween
    if not settings.get('etag_tween_disabled', False):
        config.add_tween('crabpy_pyramid.conditional_http_tween_factory')

    # create cache
    root = settings.get('cache.file.root', '/tmp/dogpile_data')
    if not os.path.exists(root):
        os.makedirs(root)

    capakey_settings = dict(_filter_settings(settings, 'capakey.'),
                            **base_settings)
    if 'include' in capakey_settings:
        log.info("The 'capakey.include' setting is deprecated. Capakey will "
                 "always be included.")
    log.info('Adding CAPAKEY Gateway.')
    config.add_renderer('capakey_listjson', capakey_json_list_renderer)
    config.add_renderer('capakey_itemjson', capakey_json_item_renderer)
    _build_capakey(config.registry, capakey_settings)
    config.add_request_method(get_capakey, 'capakey_gateway')
    config.add_directive('get_capakey', get_capakey)
    config.include('crabpy_pyramid.routes.capakey')
    config.scan('crabpy_pyramid.views.capakey')

    crab_settings = dict(_filter_settings(settings, 'crab.'), **base_settings)
    if crab_settings['include']:
        log.info('Adding CRAB Gateway.')
        del crab_settings['include']
        config.add_renderer('crab_listjson', crab_json_list_renderer)
        config.add_renderer('crab_itemjson', crab_json_item_renderer)
        _build_crab(config.registry, crab_settings)
        config.add_directive('get_crab', get_crab)
        config.add_request_method(get_crab, 'crab_gateway')
        config.include('crabpy_pyramid.routes.crab')
        config.scan('crabpy_pyramid.views.crab')
def includeme ( config ) : settings = _parse_settings ( config . registry . settings ) base_settings = _get_proxy_settings ( settings ) if not settings . get ( 'etag_tween_disabled' , False ) : config . add_tween ( 'crabpy_pyramid.conditional_http_tween_factory' ) root = settings . get ( 'cache.file.root' , '/tmp/dogpile_data' ) if not os . path . exists ( root ) : os . makedirs ( root ) capakey_settings = dict ( _filter_settings ( settings , 'capakey.' ) , ** base_settings ) if 'include' in capakey_settings : log . info ( "The 'capakey.include' setting is deprecated. Capakey will " "always be included." ) log . info ( 'Adding CAPAKEY Gateway.' ) config . add_renderer ( 'capakey_listjson' , capakey_json_list_renderer ) config . add_renderer ( 'capakey_itemjson' , capakey_json_item_renderer ) _build_capakey ( config . registry , capakey_settings ) config . add_request_method ( get_capakey , 'capakey_gateway' ) config . add_directive ( 'get_capakey' , get_capakey ) config . include ( 'crabpy_pyramid.routes.capakey' ) config . scan ( 'crabpy_pyramid.views.capakey' ) crab_settings = dict ( _filter_settings ( settings , 'crab.' ) , ** base_settings ) if crab_settings [ 'include' ] : log . info ( 'Adding CRAB Gateway.' ) del crab_settings [ 'include' ] config . add_renderer ( 'crab_listjson' , crab_json_list_renderer ) config . add_renderer ( 'crab_itemjson' , crab_json_item_renderer ) _build_crab ( config . registry , crab_settings ) config . add_directive ( 'get_crab' , get_crab ) config . add_request_method ( get_crab , 'crab_gateway' ) config . include ( 'crabpy_pyramid.routes.crab' ) config . scan ( 'crabpy_pyramid.views.crab' )
Include `crabpy_pyramid` in this `Pyramid` application.

    :param pyramid.config.Configurator config: A Pyramid configurator.