Fantastic;

I got it working another way; but I will change to this much more concise;

I called auth.user.id instead which worked;

Is there any drawbacks to the way I did it? I think one uses the authenticated user while yours passes the form that was just submitted...

Thanks.




On 2/9/11 10:09 AM, Massimo Di Pierro wrote:
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