Binding of CubicWeb connection to Pyramid request.


Enables the core features of Pyramid CubicWeb.

Automatically called by the ‘pyramid’ command, or via config.include('cubicweb.pyramid.code'). In the later case, the following registry entries must be defined first:


A cubicweb ‘config’ instance.


The correponding cubicweb repository.


The vreg.

cubicweb.pyramid.core.repo_connect(request, repo, eid)[source]#

A lightweight version of cubicweb.server.repository.Repository.connect() that does not keep track of opened sessions, removing the need of closing them

cubicweb.pyramid.core.get_principals(login, request)[source]#

Returns the group names of the authenticated user.

This function is meant to be used as an authentication policy callback.

It also pre-open the cubicweb session and put it in request._cw_cached_session for later usage by _cw_session().


If the default authentication policy is not used, make sure this function gets called by the active authentication policy.

  • login – A cubicweb user eid

  • request – A pyramid request


A list of group names


Obtains a cw session from a pyramid request


request – A pyramid request

Returns type


Not meant for direct use, use request.cw_session instead.


Obtains a cw session from a pyramid request

The connection will be commited or rolled-back in a request finish callback (this is temporary, we should make use of the transaction manager in a later version).

Not meant for direct use, use request.cw_cnx instead.


request – A pyramid request

Returns type


Some code that used to be in cubicweb.pyramid.core has been moved to cubicweb_web.bwcompat: