PDB lets you do what you want.  I use the low-tech approach: in the view 
I want to debug, I add a line of code which invokes pdb:

def my_view(request, arg1, arg2):
    import pdb; pdb.set_trace()
    # The rest of the view code...

set_trace() is the function which breaks into the debugger.  Yes, this 
could be named better.  A prompt will appear on the server's console 
(for example, the console window in which you started the development 
server), and you will be able to use pdb commands.

In pdb, you can use 'n' to step to the next line, 's' to step into the 
current function call, 'l' to list the code around the execution point, 
'p something' to print the expression 'something', and 'c' to continue 
execution.

--Ned.
http://nedbatchelder.com/blog

Greg Donald wrote:
> On 3/9/07, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote:
>   
>> What do you mean by "access into the execution stack directly"?
>>     
>
> Perhaps I am not using the correct terminology.  When I create a view
> that handles a form post, how can I interrogate the request.POST?  How
> can I breakpoint just as execution enters the view, drop to a console,
> then proceed with examining the environment from the python command
> line interpreter?
>
>   
>> With
>> "PythonEnablePdb On", you get the pdb prompt
>>     
>
> Do I set this in the server environment?  Where do I get this prompt
> exactly?  Is there some listener script I need to run?
>
>   
>> just before the django
>> handler is called. After that you can step, set breakpoints, etc.
>>     
>
> Is there a tutorial or howto for all of this?
>
>
> Thanks,
>
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to