Where do you call MyClass()?

On Friday, 5 July 2013 16:16:04 UTC-5, Remco K wrote:
>
> Hi all,
>
> I have a class in modules from which i can't access the DB object. I have 
> this:
>
> in models/db.py:
>
> db=DAL(uri, migrate=True)
> current.db = db
>
> And in modules/MyClass.py:
>
> from gluon import current
>
> class MyClass(object):
>     def __init__(self):
>         self.db = current.db
>
> But i still can't access the db object from within my class.
>
> The error i get is:
>
> AttributeError: 'thread._local' object has no attribute 'db'
>
> Can someone tell me how to use this in the right way?
>
> Thanks in advance!
> Remco
>
>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to