On Tuesday, May 10, 2011 2:10:07 AM UTC-4, niknok wrote: > > Anthony, sorry for the typo. I meant calling onvalidation=, and not > onaccept > > That is the behavior I'm expecting, since I've seen that work like so > before. Here's a stripped-down version of the function: > > def cnv(): > c_hash=request.args(0) > form=SQLFORM.factory( > Field('card_number','string' > ,label='Card number',comment='with dashes') > ,requires=CRYPT(auth.settings.hmac_key)) > if form.accepts(request.vars,session): > #import ipdb;ipdb.set_trace() > #if c_hash!= form.vars.card_number: #<------ does not work
What do you mean the above does not work? Are you expecting form.vars.card_number to equal c_hash (if so, shouldn't '!=' be '==')? Where does c_hash come from (i.e., how does it get in request.args)? > if CRYPT(auth.settings.hmac_key)(form.vars.card_number) > [0]==c_hash: What is the purpose of the above line? form.vars.card_number should already be hashed (form.accepts should result in it being hashed), so this line appears to be double hashing the card number, which I assume wouldn't match c_hash (assuming c_hash is supposed to be the hashed card number). Anthony