[web2py] Re: how login_onaccept works ?

2014-02-23 Thread brushek
Yes, I'm sure, but Marin wrote why it was wrong.

Thank both of You for Your time

regards
brushek


W dniu piątek, 21 lutego 2014 16:57:13 UTC+1 użytkownik Massimo Di Pierro 
napisał:
>
> Are you sure? It should only fire once.
>
> On Thursday, 20 February 2014 17:56:13 UTC-6, brushek wrote:
>>
>> Hello web2py users and devs,
>>
>> I have simple question: does auth.settings.login_onaccept should fire 
>> only once after login, or it is normal that it is running in every click 
>> after login ?
>>
>> I have folowing code in default.py:
>>
>> def check_production(towar=1):
>> if not session.auth:
>> return
>> user_id = str(session.auth.user.id)
>> import datetime
>> 
>> db.produkcja.update_or_insert((db.produkcja.id_field == 2) & (db.
>> produkcja.id_user == user_id),end_time = datetime.datetime.now(),id_towaru 
>> = towar)
>>
>> auth.settings.login_onaccept = check_production(1)
>>
>> As I can see, the end_time field is updated in database every time I 
>> click on site (after login). It is correct behavior ? I would like to fire 
>> this function only once, after user login. Is there any other way to achive 
>> one-time run of function after login ?
>>
>>
>> Regards 
>> brushek
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how login_onaccept works ?

2014-02-21 Thread Massimo Di Pierro
Are you sure? It should only fire once.

On Thursday, 20 February 2014 17:56:13 UTC-6, brushek wrote:
>
> Hello web2py users and devs,
>
> I have simple question: does auth.settings.login_onaccept should fire only 
> once after login, or it is normal that it is running in every click after 
> login ?
>
> I have folowing code in default.py:
>
> def check_production(towar=1):
> if not session.auth:
> return
> user_id = str(session.auth.user.id)
> import datetime
> 
> db.produkcja.update_or_insert((db.produkcja.id_field == 2) & (db.
> produkcja.id_user == user_id),end_time = datetime.datetime.now(),id_towaru 
> = towar)
>
> auth.settings.login_onaccept = check_production(1)
>
> As I can see, the end_time field is updated in database every time I click 
> on site (after login). It is correct behavior ? I would like to fire this 
> function only once, after user login. Is there any other way to achive 
> one-time run of function after login ?
>
>
> Regards 
> brushek
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.