Re: [web2py] Re: Shell controllers views

2011-01-22 Thread mikech
From a beginners standpoint, both in Python and web2py, it might be useful to use the shell to see the results from the controllers and views. Wrapping it in some easy to launch form would also be helpful. I've tried using the above code in the shell but with little success. Maybe this would

Re: [web2py] Re: Shell controllers views

2011-01-20 Thread Arun K.Rajeevan
I too was wondering after I read flame wars on reddit about web2py vs django. Do everything in the shell philosophy... ;) Also, I wanted to test my controllers and templates in the shell itself. yesterday I read the tests for the first time and saw something that does what I want. But I

[web2py] Re: Shell controllers views

2011-01-19 Thread Massimo Di Pierro
No. You can only access the models. On Jan 19, 12:31 am, walter wdv...@gmail.com wrote: Question about a shell. Can I interact to controllers and views as easy as a DB? If it is true, how?

Re: [web2py] Re: Shell controllers views

2011-01-19 Thread Bruno Rocha
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

Re: [web2py] Re: Shell controllers views

2011-01-19 Thread howesc
hmmm, something say like: def unittests(): test the ability to run unittests import os import sys import glob import cStringIO from gluon.shell import env #save stdout so we can capture data and reset it. stdout = sys.stdout stderr = sys.stderr

Re: [web2py] Re: Shell controllers views

2011-01-19 Thread Anthony
Would exec_environment() be useful here: http://web2py.com/book/default/chapter/04#Execution-Environment On Wednesday, January 19, 2011 11:47:26 AM UTC-5, rochacbruno wrote: 2011/1/19 Massimo Di Pierro massimo@gmail.com No. You can only access the models. I wonder if it is possible

Re: [web2py] Re: Shell controllers views

2011-01-19 Thread Bruno Rocha
So, the answer is YES, you can interact with controllers within the shell, I think web2py could have some helper to wrap that. file '/controllers/default.py' def sum(): n = request.vars.num return 1+n /file shell from gluon.shell import exec_environment request.vars Storage {}

Re: [web2py] Re: Shell controllers views

2011-01-19 Thread Bruno Rocha
Simply: exec_environment('applications/welcome/controllers/default.py',request=request).sum() 5 Bruno Rocha http://about.me/rochacbruno/bio