When I startup web2py without a database, it creates it. When this
happens I wish to 'pre-load' some data for testing.
How do I create a user with a password?
I'm putting code in db.py like:
if not db().select(db.auth_user.ALL): #database is empty
import hashlib
key = auth.settings.hmac_key
#users
userid = db.auth_user.insert(first_name='Joe',
last_name='Hill',
email='[email protected]',
password = hmac.new(key, 'jh', hashlib.sha512).hexdigest()
)
#groups
clientgp = auth.add_group('client', '')
#permissions
auth.add_permission(clientgp,'create', 'product', 0)
#links
auth.add_membership(clientgp, userid)
which creates the user appropriately, but the user:password does not
work.
Karl
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.