Read the callout box at the end of this 
section: 
http://web2py.com/book/default/chapter/04#Accessing-the-API-from-Python-modules.
 
You're not supposed to assign items from 'current' to global variables 
within the module, which are defined only once when the module is first 
imported.

Anthony

On Monday, December 5, 2011 8:07:09 PM UTC-5, Francisco Costa wrote:
>
> Hi,
> in models/db.py I have:
>
> from gluon.globals import current
> current.db = db
>
>
> In modules/example.py I have:
>
> from gluon.globals import *
> db = current.db
>
>
> but I get this error: AttributeError: 'thread._local' object has no
> attribute 'db'
>
>
> if I print current.db I get the output but why can't I assign it to a
> variable?
>
>

Reply via email to