On Sep 18, 2006, at 10:28 PM, John Tidmarsh wrote: > I am trying to learn QP by writing a simple application. I am new > to object > databases as well. > > The application redirects users who don't have an account to a > 'create account' page.I am unable to store new user accounts in the > users database. I understand 'users', 'session, are built-in sort- > of-tables. Here's the > relevant snippet: > ---------------------------- > publ = get_publisher() > print repr(users_db.items()) > u1 = User(login_name) > u1.set_password(passwd) > users_db.add(u1) > print repr(users_db.items()) > publ.commit () > --------------------------- > The print statements do show a new user has been added. But the new > user > doesn't get committed to the database. > > Is this the right way to add new accounts to the 'users' db. Any > help in > understanding how transparent persistence works in QP will be > appreciated. new_user = User(login_name) new_user.set_password(passwd) users = get_publisher().get_users() # users is a BTree users[login_name] = new_user If this code is part of your user registration form, you don't need to call commit() yourself. The publisher will do that before sending the response, if there is something to commit, and there are no exceptions. I'm not sure what your user_db is. Is it an instance of some persistent class? How does it actually hold the User instances that are added? Has the user_db already been committed to the database? Are you familiar with the "-i" and "-l" commands of the "qp" command? We find them very helpful. Can you start "qp -i" and find your user_db instance waiting for you?