pyramid_cubicweb/init_instance.py
author Christophe de Vienne <christophe@unlish.com>
Mon, 22 Sep 2014 09:40:43 +0200
changeset 11512 bb548010b390
parent 11492 b0b8942cdb80
permissions -rw-r--r--
Use lightweight sessions Provides a lightweight version of repo.connect() that does not keep track of opened sessions. The speed gain on a mostly static front page is about 5% Warning ! This means that, for now, the "session_open" and "session_close" hooks are NOT called anymore.

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