[Cubicweb] Pyramid & Cubicweb sessions/authentication integration

Christophe de Vienne christophe at unlish.com
Sun Jul 6 18:35:17 CEST 2014

Hi all,

A few lines to keep you informed on the pyramid / cubicweb integration

This afternoon I worked on an important step that will make everything
else possible : integrating the authentication stack of pyramid and the
cubicweb session management, and it's all working pretty well !

Some basic explanations :

  * The pyramid application uses directly the cw repo to check the
    login/password of the user (110
  * The pyramid request has a custom attribute 'cw_session' that gets,
    one way or another, a cubicweb session (164
  * A custom session manager (66
    rely on this new attribute to return the session to cubicweb.

A possible next step will be to use directly "core_handle"
ofCubicWebPublisher instead of "handle_request". This way, we will have
a better control on what connection is used, and we'll be able to let
pyramid handle errors (which doesn't mean we won't use the custom error
views of cw).

If you want to give it a try, you can use the sampleapp I included in
the source.
Do do so :
- have pyramid > 1.5 in your environment (I suggest using virtualenv and
- run "python setup.py develop" or "python setup.py install" in the root
directory AND the sampleapp directory
- change the 'cubicweb.instance' entry of the development.ini file to
one of your own instance names
- change the port to match your instance tcp port (still in development.ini)
- run "pserve --reload development.ini"
- hit "http://localhost:8080" (or whatever your instance port is)
Enjoy !


PS: reminder, the sources are at :
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140706/567f5db9/attachment-0185.html>

More information about the Cubicweb mailing list