The idea is correct but f should be the form and you should not save a
record in session without converting to a python dict.

def load_settings(form):
     settings = db.settings(db.settings.user == form.vars.id)
     session.settings = settings.as_dict()

auth.settings.login_onaccept = lambda form:load_settings(form)

On Feb 8, 11:33 pm, "David J." <da...@styleflare.com> wrote:
> I am using the default web2py login mechanism;
>
> I am not sure where I can run additional queries after a successful login?
>
> I tried doing
>
> def load_settings(f):
>      settings = db.settings(db.settings.user == f.id)
>      session.settings = settings
>      return
>
> auth.settings.login_onaccept = lambda f:load_settings(f)
>
> This anyway throws an exception;
>
> Even if this were to work; would this be the best place to do this?
>
> I want to store the settings on the "Profile" page
>
> The settings are read only on that page they click a link to modify the
> setting which handles all the CRUD methods.
>
> Any advice would be greatly appreciated.
>
> Thanks.

Reply via email to