Here is the origin of the problem.
 I have two apps, I noticed that one function was using data from a db of
another app. When I changed that, to pick data from the apps db that's when
the error started. when using back the previous db the error is not there.
I have tried to make several changes including renaming the db in vain.
Now another thing is that the error is 'temporary' in that when I restart
the server, and click on clean, under 'manage' and then open the app the
error disappears.

On Sat, 13 Oct 2018, 00:16 Yoel Benitez Fonseca <[email protected]> wrote:

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

-- 
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