On Sep 30, 2011, at 12:16 PM, howesc wrote:
> Thanks for the help guys! i knew it was in there hiding....
>
> for reference, here is what i did (i'm running on GAE):
>
> in db.py:
> from gluon.globals import current
> db = DAL('gae') # connect to Google BigTable
> current.db=db
>
> in my module:
> from gluon.globals import current
> db=current.db
>
> thanks!
>
One caution here. It's probably best to try to avoid possible future namespace
conflicts in current by using an app-specific dict/Storage in current for your
private variables. Something like:
current.myappname = Storage()
current.myappname.db = db
We discussed a while back formalizing this, perhaps with a current.apps
dict/Storage predefined (you'd use current.apps.myappname in that case), but
nobody seemed to have the energy for it.