Sorry Anthony but it seems to that the original question was about accesing db trough current, with is not set in current by default so my answer is about that's.
You need to set current.db in a models an in a module: from gluon import current ... def my_module_resident_func(): db = current.db auth = current.auth And there u go with access to any thing you can attach to current On Oct 12 2018, at 5:08 pm, Anthony <[email protected]> wrote: > > On Friday, October 12, 2018 at 4:59:07 PM UTC-4, Yoel Benitez Fonseca wrote: > > In a model do, in db.py at the end if u can: > > > > def _(): > > from gluon import current > > > > current.db = db > > current.auth = auth > > _() > > > > Remember's the book says: don't import current into module level code. > > Putting the above code in a function in the model file is not necessary -- a > model is not a module. You can use current at the top level of a model file, > as models are executed per request. > > 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] > (mailto:[email protected]). > For more options, visit https://groups.google.com/d/optout. > -- 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.

