• 699 views
  • 0 comments
  • loading...

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. See below.

One should first check that the value is an integer so that an exception will not occur.





requires = IS_EXPR('int(value)%3==0',

error_message='not divisible by 3')

requires = [IS_INT_IN_RANGE(0, 100), IS_EXPR('value%3==0')]

Attributes / Arguments


requires = [IS_INT_IN_RANGE(0, 100), IS_EXPR('value%3==0')]

Displays an error message

requires = IS_EXPR('int(value)%3==0',
                   error_message='not divisible by 3')


loading...

Sources / Reference

" Web2py Book"


Comments

loading...

Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)