Re: [web2py] Re: can i "import" db into module?

2011-09-30 Thread Anthony
On Friday, September 30, 2011 3:28:23 PM UTC-4, Jonathan Lundell wrote: > > > 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. > I think there was some

Re: [web2py] Re: can i "import" db into module?

2011-09-30 Thread howesc
thanks for the wise advice. i've updated to create a namespace in current. given that it's up to the developer to follow the convention i think it's ok to make the developer create a storage() or dict() object if they want the namespaceing. thanks, cfh

Re: [web2py] Re: can i "import" db into module?

2011-09-30 Thread Jonathan Lundell
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 > curr

[web2py] Re: can i "import" db into module?

2011-09-30 Thread howesc
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

[web2py] Re: can i "import" db into module?

2011-09-30 Thread DenesL
The good book says: http://web2py.com/book/default/chapter/04?search=current#Accessing-the-API-from-Python-modules

[web2py] Re: can i "import" db into module?

2011-09-30 Thread Lazarof
http://groups.google.com/group/web2py/browse_thread/thread/b254eae320294f2f/975926ef07c06db4?lnk=gst&q=solution#975926ef07c06db4 On Sep 29, 11:56 pm, apple wrote: > I also want to know the answer to this. I have followed an example but > could not get it to work. > > In model I have: > > from glo

[web2py] Re: can i "import" db into module?

2011-09-30 Thread Lazarof
On Sep 29, 11:56 pm, apple wrote: > I also want to know the answer to this. I have followed an example but > could not get it to work. > > In model I have: > > from globals import current > from gluon.storage import * > current.app=Storage() > current.app.db=db > > If I put in my module X: >    

[web2py] Re: can i "import" db into module?

2011-09-29 Thread apple
I also want to know the answer to this. I have followed an example but could not get it to work. In model I have: from globals import current from gluon.storage import * current.app=Storage() current.app.db=db If I put in my module X: from globals import current then it says "no module named