Traceback (most recent call last): File "gluon/restricted.py", line 184, in restricted File "E:/web2py1.72.3/applications/mug/models/db.py", line 103, in <module> File "gluon/sql.py", line 1498, in __getattr__ KeyError: 'requires'
Note I'm using 1.72.3 until I get 1.74.4 working Karl On Dec 25, 12:54 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > Silly me. Too much food. > > password=db.auth_user.requires('yourpassword')[0] > > On Dec 25, 1:12 pm, kbochert <kboch...@copper.net> wrote: > > > No Luck. > > Causes a missing key error. (db does not have a 'auth_table') Maybe > > this is new since 1.72.3? > > I tried numerous permutations without success. I am deleting the > > database files and restarting the server for each test. > > > Karl > > > On Dec 25, 7:20 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > replace > > > > password=hmac.new(key, 'jh', hashlib.sha512).hexdigest() > > > > with > > > > password=db.auth_table.requires('yourpassword')[0] > > > > I think the problem is that if you use hashlib.sha512 you have to add > > > 'sha512:' in front of the hexdigest. look into CRYPT for details. > > > > On Dec 25, 4:31 am, kbochert <kboch...@copper.net> wrote: > > > > > 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='jh...@copper.net', > > > > 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 web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.