Thanks for the suggestion. I tried it but I was unable to make use of
it. Your suggestion did force me to rethink the design so I discarded
the full IS_MATCH  string(can't even remember why I went for that),
and simply kept the expression string itself (i.e. '^\\d{3}-\\d{4}-\
\d{4}-\\d{1}?$')

And now it works and looks much cleaner without eval() ...

requires=[IS_MATCH(str(db.agency[int(request.vars.issuer or
1)].regex)),CRYPT(auth.settings.hmac_key),IS_NOT_IN_DB(db,'card.id_number')]

Thanks

On May 7, 12:04 am, pbreit <pbreitenb...@gmail.com> wrote:
> Maybe the IS_EXPR() validator?
>
> IS_EXPR
> IS_EXPR
>
> Its first argument is a string containing a logical expression in terms of a
> variable value. It validates a field value if the expression evaluates to
> True. For example:
>
> 1.
> 2.
>
> requires = IS_EXPR 
> <http://web2py.com/book/default/docstring/IS_EXPR>('int(value)%3==0',
>                    error_message=T 
> <http://web2py.com/book/default/docstring/T>('not divisible by 3'))

Reply via email to