2011/1/19 Massimo Di Pierro <massimo.dipie...@gmail.com>

> No. You can only access the models.


I wonder if it is possible to start web2py in Shell mode, execute a
controller under the web2py environment.
inspect the controllers 'return' or use template.py to evaluate a view file
passing the controller return as argument.

is there something like that?

<dummy example>
$python web2py.py -S myapp -M -P
>>> db.tables
['mytable']
>>> my_return = execfile(/controllers/controller.py)
>>> print my_return['someobject']
>>> from gluon.template import *
>>> print template.parse('/views/controller.html',response._vars=my_return)
'<html>.........................</html>

</dummy example>

I guess I saw something like this in web2py_test_runner.

If something like that could be possible, this will be easy to UnitTest
web2py controllers and views.

Reply via email to