gotcha. it's because examples do not have a db defined in recent version. BTW: you should make your tests on the scaffolding app (welcome) if not creating a new one just to test things. You were 3 clicks away from it (choose a name, click on "create a simple app", edit default.py, save)
Il giorno giovedì 23 agosto 2012 11:35:18 UTC+2, Simon Ashley ha scritto: > > Having issues with SQLFORM.grid with the latest trunk (2012-08-22 > 23:37:57) throwing "NameError: name 'auth' is not defined" errors. > To reproduce the error, downloaded a fresh build and unzipped to a fresh > folder. > In the examples application, created a new controller, with the following > code extracted from the book: > > @auth.requires_login() > def manage_users(): > grid = SQLFORM.grid(db.auth_user) > return locals() > > When run, it throws the following: > > > 127.0.0.1.2012-08-23.19-21-36.0ffdb33a-7e1a-4ea8-adc0-aff4c95eab52 > <type 'exceptions.NameError'> name 'auth' is not definedVERSIONweb2py™(2, > 0, 0, datetime.datetime(2012, 8, 22, 23, 37, 57), 'dev')PythonPython > 2.7.1: C:\Python27\pythonw.exeTRACEBACK > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > > Traceback (most recent call last): > File "c:\web2py5\gluon\restricted.py", line 206, in restricted > exec ccode in environment > File "c:/web2py5/applications/examples/controllers/test.py" > <http://127.0.0.1:8000/admin/default/edit/examples/controllers/test.py>, line > 1, in <module> > @auth.requires_login() > NameError: name 'auth' is not defined > > > Its occurred over the last few trunk versions. A version from 2012-7-21 is > OK, and have rolled back to that. > Is there something that I should be aware of? > > > --

