On 03/11/2012 11:47 PM, Tres Seaver wrote:
> On 03/11/2012 05:36 PM, alex bodnaru wrote:
> 
>> hello friends,
> 
>> thanks again for repoze.*
> 
> Glad you find them useful!
> 
>> one question: i've seen an api login method for repoze 2.
> 
>> from repoze.who.api import get_api who_api = get_api(request.environ) 
>> authenticated, headers = \ who_api.login(dict(login=Login,
>> password=UserPass))
> 
>> how could i login a user in a program using repoze 1?
> 
> You have put your finger on it:  The separate API is really the major new
> feature in r.who 2.0.
> 
>> i came up with the following solution, but is it the best way to go?
> 
>> plugins = request.environ.get('repoze.who.plugins').values() 
>> rememberers = [auth for auth in plugins if hasattr(auth, 'remember')]
> 
>> res = rememberers and \ rememberers[0].remember(request.environ,
>> dict(login=Login, password=UserPass))
> 
> That is pretty much the required workaround for the lack of an API in
> r.who 1.x.
> 
> 
> Tres.

thank you very much.

best regards,
alex
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to