On Sunday, May 7, 2017 at 4:44:07 AM UTC-4, Pierre wrote: > > I just repeated what's written in the web2py book : > > > For example a model could do > > auth = Auth(db) > from gluon import current > current.auth = auth > current.db = db #not needed in this case but useful > > and now all modules imported can access current.auth. > > current and import create a powerful mechanism to build extensible and > reusable modules for your applications. >
I wasn't saying you don't ever need to do anything like the above, just that you specifically do not need to do it in order to attach the T object to current, as the framework already does that for you. Note, the excerpt you cite above from the book is immediately preceded by the following: Modules that import current can access: - current.request - current.response - current.session - current.cache - current.T and any other variable your application chooses to store in current. > I'll check without the import......what about the datetime module how do i > access it without re-importing ? > Not sure what you mean -- you should import datetime wherever you need it. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

