But the DB object can be static through requests as well or I should instantiate it on every request too?
On Tue, Aug 14, 2012 at 10:02 AM, Anthony <abasta...@gmail.com> wrote: > modules/web2py/auth.py: >> >> auth = Auth(db, hmac_key=Auth.get_or_create_**key()) >> > > Where does that db object come from? Note, global objects are defined only > once when the module is first imported, so any such objects are associated > with the first request and are not re-created with each request. Instead, > you should put the Auth code inside a function or class and pass in the db > object from the controller: > > module: > > def initialize_auth(db): > auth = Auth(db, ...) > auth.define_tables > return auth > > controller: > > import initialize_auth > auth = initialize_auth(db) > > Anthony > > -- > > > > -- Att, Felipe Meirelles. --