pyramid_cubicweb/init_instance.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 03 Jun 2016 17:59:49 +0200
changeset 11625 b23d60a9ea84
parent 11492 b0b8942cdb80
permissions -rw-r--r--
retrieve session data in a single query instead of two (one for the session object, the other for its cwsessiondata attribute).

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