Web to py enterprise web framework - p 15
EXECUTION ENVIRONMENT
125
models and controllers are designed to be executed in a prepared environment that has been prepopulated with web2py global objects (request, response, session, cache and T) and helper functions. This is necessary because Python is a statically (lexically) scoped language, whereas the web2py environment is created dynamically. web2py provides the exec environment function to allow you to access models and controllers directly. exec environment creates a web2py execution environment, loads the file into it and then returns a Storage object containing the environment. The Storage object also serves as a namespacing mechanism. Any Python file designed to be executed...