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
        if CRYPT(auth.settings.hmac_key)(form.vars.card_number)
[0]==c_hash:
            db.card.validated.writable=
db.card.modified_by.writable=True
            db(db.card.alnum==c_hash).update(validated=True)
            response.flash='Card number validated.'
        else:
            form.errors.card_number='Card number is not valid!'
    return dict(form=form)

On May 10, 12:11 pm, Anthony <abasta...@gmail.com> wrote:
> On Monday, May 9, 2011 10:59:46 PM UTC-4, pbreit wrote:
>
> > Do filters work with SQLFORM.factory? I'm not sure CRYPT returns an
> > encrypted string so much as it causes the string to be encrypted when
> > SQLFORM puts it in the DB. I could be wrong.
>
> When I create a SQLFORM.factory with a requires=CRYPT and call form.accepts,
> I get back a hash of the input, even without any db IO.
>
> Anthony

Reply via email to