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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to