On Tuesday October 21, 2008 11:32:06 Helio Pereira wrote: > Hi all, > > I have searched TG2 documentation and here in this maillist but can't > get the information I need :-P > > 1 - How can I access the Session inside TG2. I need to store more > information inside the session (server side) > > I know the session is named as 'authtkt' but in my configuration have: > beaker.session.key = bp > beaker.session.secret = somesecret > beaker.cache.data_dir = %(here)s/data/cache > beaker.session.data_dir = %(here)s/data/sessions > > Is there anyway where I can read about this ? > > 2 - After a user made a successful login, where I can see inside TG2 > the current user id ?
I don't know about the first question, but to get the user Id you may use: > from pylons import request > request.environ.['repoze.who.identity']['repoze.who.userid'] But notice that request.environ['repoze.who.identity'] is None when the visitor has not been authenticated. I think I'll make a short-cut to the code above by including a get_userid() function in tgext.authorization.authorize. -- Gustavo Narea. http://gustavonarea.net/ Get rid of unethical constraints! Switch to Freedomware: http://softwareliberty.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
