you are calling the function and assigning the return value

use = lambda: check_production(1)
or just = check_production, without (1)

Marin (mobile)
On Feb 21, 2014 12:56 AM, "brushek" <[email protected]> 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 to fire this
> function only once, after user 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to