New in version 1.27
by Limodou
Shell.py is a commandline tool, you can use it to do some testing work. You can find it in web2py installation folder. If you want to test some appliance just run:
on Unix
python2.5 web2py.py -S appname
on Windows
web2py.exe -S appname
And it'll prepare a web2py environment for appname, and then go into interactive mode. So you can test controller or model or other python code there. For example, type:
>>> INPUT(_name='name', _type='text').xml()
'<input type="text" name="name"/>'
And if you've installed ipython tool, it'll automatically find the ipython and use it. Other command line options:
-P, --plain to ignore IPython and use a regular shell
-M, --import_models it'll automatically find all model files in app's models folder, and then execute them in web2py environment. So you can directly use your db objects defined in model files. Have fun with it. Requires version 1.28 or later.
ATTENTION: Notice that while in models and controllers commit/rollback is automatic, in the shell you have to explicitly db.commit() or db.rollback() your transactions.