[Cubicweb] How to get session data?

Adrien Di Mascio adrien.dimascio at logilab.fr
Wed Jun 3 08:42:53 CEST 2009


Hi Sandrine,

On Tuesday 02 June 2009 21:16:44 Sandrine Ribeau wrote:
> I can not find a way to collect and add data to the current session within
> a view.
> I found how to use self.req.get_session_data/set_session_data and
> self.req.get_shared_data/set_shared_data but this works for the request,
> not for the user session.
> What is the appropriate method to get/set an authenticated user session?

req.get/set_session_data() is the correct way to do this. It should work.

req.get/set_shared_data() are used to share some information between the 
session on the server-side (the repository) and the client-side (the web 
application).

Anyway, beware of the expiration-time of the web session !
Hope this helps,

-- 
Adrien Di Mascio                              LOGILAB, Paris (France).
Formations Python,Zope,Debian,Calcul    http://www.logilab.fr/formations
Développement logiciel sur mesure:      http://www.logilab.fr/services
Informatique scientifique:              http://www.logilab.fr/science
Gestion de connaissances:               http://www.cubicweb.org/
Python in Python:     http://codespeak.net/pypy/dist/pypy/doc/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20090603/65eba2e6/attachment-0272.sig>


More information about the Cubicweb mailing list