>
> Ins't it weird that after the onaccept callback the user is still not 
> logged in?  what is the difference between onaccept and onvalidate then?
>

No, your problem is not that the user isn't logged in after onaccept -- 
it's that you test whether the user is logged in in your model file, and 
that test happens before the user is logged in (and therefore before the 
onaccept is called), so the default value never gets set. Here's the order:

1. model file:
 if auth.is_logged_in()  # user not logged in yet because login form input 
hasn't been processed yet

2. default.py controller:
def user():
    return dict(form=auth())  # user gets logged in here, after the test in 
step 1

In other words, the login happens in the controller, but you're testing for 
login in a model file, before execution reaches the controller.

Maybe try:

db.log.insert(action=action, details=details, created_by=auth.user_id) 

Anthony


Reply via email to