I think this is not a bug. Auth needs 'request' to build some paths and also will need it to do other things.
The fact is that Auth was designed to run in a server-client environment, where server will always have a request object. if you need to run in exec_environment or in shell mode you will need to mock some things. you can build your own request object and populate it. current.request = request request.folder = 'somepath' ... To be honest, I think exec_environment should not be used to build applications, unless you have a very special case and are prepared to mock every missing object needed. Less models, Less code in controllers and more class based login in modules and you will have a better system. 2011/12/5 Mirek Zvolský <[email protected]> > 1.99.2, WinXP > > Model works fine from browser and from integrated shell. > But there is problem from exec_environment, when model contains Auth: > > os.chdir(r'c:\python27\Lib\site-packages\web2py') > from gluon.shell import exec_environment > cas = exec_environment('applications/cas/models/db.py') > > > Traceback (most recent call last): > File "<pyshell#80>", line 1, in <module> > cas = exec_environment('applications/ereceipts_server/models/ > db.py') > File "C:\Python27\Lib\site-packages\web2py\gluon\shell.py", line 71, > in exec_environment > execfile(pyfile, env) > File "applications/ereceipts_server/models/db.py", line 36, in > <module> > auth = Auth(db, hmac_key=Auth.get_or_create_key()) > File "C:\Python27\Lib\site-packages\web2py\gluon\tools.py", line > 811, in get_or_create_key > request = current.request > AttributeError: 'thread._local' object has no attribute 'request' > -- Bruno Rocha [http://rochacbruno.com.br]

