I could not actually get user=identity.user to work :(
Two options for getting the user; is one better than the other?
1)
uid=request.identity['repoze.who.userid']
user=User.by_user_name(uid)
2)
user2=request.identity['user']
These both get the same user object in my tests. Are they both
correct to use, or is option number 2 an undocumented feature that may
go away in a future TG version?
El Tea
On Jul 21, 3:50 pm, percious <
ch...@percious.com> wrote:
> you can get the current logged in identity by grabbing it from the
> environ:
>
> identity = request.environ.get('repoze.who.identity')
> user = identity.user
> group_names = identity.groups
>
> Lots of folks do something like this in their __call__ method of their
> BaseController:
>
> tmpl_context.identity = request.environ.get('repoze.who.identity')
>
> See docs here:
http://www.turbogears.org/2.0/docs/main/Auth/Customization.html#enabl...