On Saturday, January 22, 2011 4:38:35 PM UTC-5, walter wrote: > > It is the web2py/site-packages. OK! Many thanks.
See http://web2py.com/book/default/chapter/04#Third-Party-Modules. Depending on your needs, you can import Python modules from 'site-packages' or put the code in your applications 'modules' folder and use web2py's local_import() function (explained in the above link). You can also put such code in a model file because all model files are executed on every request, so code in your model files is always available to all controllers and views (without requiring any imports). Such code also has access to the web2py global objects (such as 'request'). In terms of pure MVC separation, such code may not really belong in a model file (i.e., it may not really have anything to do with your data/models), but because of the way web2py works, it can be a convenience for some application-wide helpers. Anthony

