What you are looking for is probably:

response.headers =
request.environ['repoze.who.plugins']['main_identifier'].remember(request.environ,
{'repoze.who.userid':user_name})

The user_name variable is the User.user_name field in a standard TG2
configuration.

For a more structured function to use take a look at
http://stackoverflow.com/questions/4576486/turbogears-change-user-via-function-calls/6636220#6636220

On Sun, Jan 29, 2012 at 4:37 PM, Cosmia Luna <[email protected]> wrote:
> I'm new to TurboGears and switched from Django before, though Django works
> well.
>
>> In a nutshell, how to get a User instance by email and password like
>> Django does, and log he/she in?
>
>
> How does repoze processing to check if a user is logged in or not? How can I
> tell repoze how to determine identified or not? And how to log a user in?
>
> Of course I can manually check the database, manually set the cookies and
> session ... but I think it's a better way to use the repoze, maybe.
>
> I read many documentations ( including the repoze.who/what's documentation,
> of course ), and get a lot of not-very-useful-by-now knowledge, but don't
> know how to do that.
>
> I use TurboGears 2.1
>
> Thanks
>
> Cosmia Fu
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/HK0csGomKugJ.
> 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?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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?hl=en.

Reply via email to