Alright, I'm burned out on trying to solve this. I'm trying to make a form that checks if two fields match, like password + verify password. I noticed in the book that there's an example of this, but I can't seem to get it working. The code given is as follows (this is with a typo correction, a quote is missing in IS_EXPR in the book):
def index(): match_it = IS_EXPR('value==repr(request.vars.password)', error_message='passwords do not match') form = SQLFORM.factory( Field('username', requires=IS_NOT_EMPTY()), Field('password', requires=IS_NOT_EMPTY()), Field('password_again', requires=match_it)) if form.accepts(request.vars, session): pass # or take some action return dict(form=form) I run this code exactly, and while it works for displaying the page, as soon as I submit the form I get the following error: Traceback (most recent call last): File "gluon/restricted.py", line 178, in restricted File "E:/development/web2py/applications/informed/controllers/ users.py", line 23, in <module> File "gluon/globals.py", line 96, in <lambda> File "E:/development/web2py/applications/informed/controllers/ users.py", line 11, in index File "gluon/sqlhtml.py", line 857, in accepts File "gluon/html.py", line 1311, in accepts File "gluon/html.py", line 454, in _traverse File "gluon/html.py", line 454, in _traverse File "gluon/html.py", line 454, in _traverse File "gluon/html.py", line 454, in _traverse File "gluon/html.py", line 461, in _traverse File "gluon/html.py", line 1118, in _validate File "gluon/validators.py", line 156, in __call__ File "<string>", line 1, in <module> NameError: name 'request' is not defined Now I imagine this is happening because the IS_EXPR code doesn't have access to the request global. If this is the case, then how can I achieve the result I'm looking for, and why is this example in the book?