On Sunday, September 25, 2011 3:55:56 PM UTC-4, monotasker wrote:
>
> Thanks. A couple of points of clarification:
> 1. Are the global web2py objects (session etc.) available to classes 
> defined in a model file?
>

Yes, if you define a class in a model, all the web2py globals would be 
available. One thing to note, because models are executed by the framework, 
make sure your classes do not include a __del__ method, as that can cause a 
memory leak.
 

> 2. You mentioned the option of writing modules to import. What's the best 
> location for these? In the 'static' directory?


You should put modules in /myapp/modules. If you have 
/myapp/modules/mymodule.py, then all you have to do to import it is 'import 
mymodule.py', and the web2py custom importer will look in the application's 
'modules' folder before checking the rest of sys.path.

Anthony

Reply via email to