A few options:

   - The admin app includes an interactive debugger -- you can set 
   breakpoints in your code and then step through.
   - If you start web2py from the shell via python web2py.py, any print 
   statements in your code will print output to that shell.
   - At any point in your code, you can raise an HTTP 
exception<http://web2py.com/books/default/chapter/29/04#HTTP-and-redirect>to 
immediately return some value to the browser (if it is a compound Python 
   object, you can wrap it in the 
BEAUTIFY<http://web2py.com/books/default/chapter/29/05#BEAUTIFY>helper for 
better display).
   - In the view, you can add {{=response.toolbar()}}, which will enable 
   you to see all the elements in request, response, and session as well as 
   db query timings.
   - appadmin allows you to see the current content of the cache as well as 
   cache statistics.

Anthony

On Wednesday, December 19, 2012 6:49:17 PM UTC-5, Bhaskar Ramachandran 
wrote:
>
> Thanks Massimo. Again, i am so new to web development.  I learned from 
> your web2py book that your framework goes through a series of actions and i 
> am assuming it creates objects in memory and fills these objects with user 
> data and then processes these objects according to the model, controller 
> and view code written for that page request.
>
> Is there a way of looking at the various web2py objects in memory at 
> different instances of time for one http request ?. For example, when a 
> user submits a login form from browser, it gets to web2py and then web2py 
> sets up the enviroment (request, response, cache, session etc objects 
> created in memory and populated with information contained in that post 
> request from browser) . 
> Now is the auth object created in memory with the user inputs of username 
> and password  at this time ?. IF so, how can i see the contents of this 
> objects at this time  before web2py proceeds further?.
>
> Then web2py runs the model python code and then runs the controller. 
> Finally the view. I could be changing the content of the objects, for 
> example, the login form object anywhere in this chain - in model code, 
> controller code or view code. Can i see how it is modified before it gets 
> converted to html by the response object ?. And then can i see the final 
> html code it generated at server side ?
>
> Finally, when the html code from server reaches the client, the browser 
> can show me the source code and i get to see what web2py has done. But i 
> want to see the intermediate actions also....
>
> Regards,
> Bhaskar
>
>
> On Tuesday, December 18, 2012 11:20:02 PM UTC-6, Massimo Di Pierro wrote:
>>
>> You cannot do what you ask because it not logically possible. There is no 
>> web2py global state. There is only a state per request for the duration of 
>> an http request.
>>
>> When you open shell you are in a "simulated" http request which does not 
>> require the server to be on. It is mostly used to programmatically interact 
>> with the db.
>>
>> Imagine your web server being hit by many requests at the same time. How 
>> would you select from the shell which one to interact with? Moreover each 
>> request lasts ~5ms.
>>
>> Massimo
>>
>>
>>
>> On Tuesday, 18 December 2012 22:16:33 UTC-6, Bhaskar Ramachandran wrote:
>>>
>>> Thanks for the reply. But then how do i do interactive debug of the 
>>> web2py objects from the shell...?
>>> If I can either have the shell or the webserver running, but not both, 
>>> then what if i want to run my application and then access the web2py 
>>> objects in real time from the shell to know its state. ?
>>> By the way, what makes it more interesting to learn web2py is this 
>>> support from others .... Thanks a lot.
>>>
>>> Regards,
>>> Bhaskar
>>>
>>>
>>>
>>>
>>> On Sunday, December 16, 2012 9:06:30 PM UTC-6, Massimo Di Pierro wrote:
>>>>
>>>> As you say -S <appname> starts the shell but not the web server. 
>>>> Without -S it starts the web server.
>>>> The reason is that you may want one without the other.
>>>>
>>>>
>>>> On Sunday, 16 December 2012 14:38:53 UTC-6, Bhaskar Ramachandran wrote:
>>>>>
>>>>> I am new to web2py but very excited to learn and use it on a long term 
>>>>> from now. 
>>>>> I am having trouble starting an interactive shell (I am using Windows 
>>>>> 7 OS and have installed python2.5 and pywin32 but not ipython as i don't 
>>>>> want ipython shell). 
>>>>> I have the latest web2py source copied to C:\. 
>>>>>
>>>>> C:\web2py>python web2py.py -S welcome -M
>>>>> Sorry, -K only supported for python 2.6-2.7
>>>>> web2py Web Framework
>>>>> Created by Massimo Di Pierro, Copyright 2007-2012
>>>>> Version 2.3.1 (2012-12-14 15:24:12) stable
>>>>> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
>>>>> PostgreSQL(pg8000), IMAP(imaplib)
>>>>> WARNING:web2py:import IPython error; use default python shell
>>>>> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
>>>>> (Intel)] on win32
>>>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> (InteractiveConsole)
>>>>> >>>
>>>>>
>>>>> I get the shell but it does not start the browser. Even if i start the 
>>>>> browser and enter http://127.0.0.1:8000/welcome/default/index     it 
>>>>> doesn't work.
>>>>> But if i try a non-interactive shell such as the following, i am able 
>>>>> to start the server and see the welcome page...
>>>>>
>>>>> C:\web2py>python web2py.py
>>>>> Sorry, -K only supported for python 2.6-2.7
>>>>> web2py Web Framework
>>>>> Created by Massimo Di Pierro, Copyright 2007-2012
>>>>> Version 2.3.1 (2012-12-14 15:24:12) stable
>>>>> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
>>>>> PostgreSQL(pg8000), IMAP(imaplib)
>>>>> ------
>>>>> I get the pop up window to enter admin password and start the server 
>>>>> and everything works except an interactive shell...
>>>>>
>>>>> Please help.
>>>>> Thank you
>>>>> Bhaskar
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>

-- 



Reply via email to