pyramid_cubicweb/init_instance.py
author Arthur Lutz <arthur.lutz@logilab.fr>
Fri, 17 Jun 2016 17:57:11 +0200
changeset 11620 2497bcf18030
parent 11492 b0b8942cdb80
permissions -rw-r--r--
split collecting setting before using them, so the function can be reused when inserting WSGI middlewares

from cubicweb.cwconfig import CubicWebConfiguration


def includeme(config):
    appid = config.registry.settings['cubicweb.instance']
    cwconfig = CubicWebConfiguration.config_for(appid)

    config.registry['cubicweb.config'] = cwconfig
    config.registry['cubicweb.repository'] = repo = cwconfig.repository()
    config.registry['cubicweb.registry'] = repo.vreg