See 
http://web2py.com/books/default/chapter/29/4#Accessing-the-API-from-Python-modules.
 
Note, "from gluon import *" imports the entire web2py API, including the 
"current" thread local object containing the environment variables.

Anthony

On Sunday, February 26, 2012 2:11:40 PM UTC-5, Ed Greenberg wrote:
>
> I create lots of modules which need to interact with my app.   I've 
> been passing things into them and wonder if I'm doing the simplest and 
> best practice: 
>
>
> aObj=local_import("a",reload=True) 
>
> a=aObj(db,auth,settings,session,module_specific_params) 
>
> Then, in the class, I use them as self.settings.foo (or whatever) 
>
> Is there a good way to make more of the environment available to my 
> module, or am I doing the right thing? 
>
> Thanks, 
>
> Ed

Reply via email to