werkzeug icon indicating copy to clipboard operation
werkzeug copied to clipboard

DebuggedApplication middleware could display local variables

Open sblondon opened this issue 6 years ago • 6 comments

I think it would be nice to show local variables for each frame. It would be useful, especially if the debugger is disabled.

For the interface, the local variables could be in a block which would be folded and unfolded with javascript. (This behaviour is equivalent to the django debugger middlware.)

I plan to do a PR if you think it's a good idea.

sblondon avatar May 21 '18 14:05 sblondon

You can already do that by typing dump() in a frame's console.

davidism avatar May 21 '18 16:05 davidism

@davidism i believe @sblondon meant for when the console is disabled for a debugger (so dump wont work)

RonnyPfannschmidt avatar May 21 '18 17:05 RonnyPfannschmidt

That seems like a security issue. Tying it to the console means you have to enter a pin before seeing that information.

davidism avatar May 21 '18 17:05 davidism

@davidism would it be reasonable to have it require the pin as well (i believe not having a python shell would limit the damage somebody that took the credentials could do while still enabling basic debugging)

RonnyPfannschmidt avatar May 21 '18 17:05 RonnyPfannschmidt

Yes, it would be a solution: when the pin is validated, each local variables would be inserted in the html.

sblondon avatar May 23 '18 13:05 sblondon

Are there any plans to add this? I am new to the Werkzeug debugger and I like the console. I know I can get the local variables by using the console, but it would be a lot more convenient if they were there by default.

I noticed that by default the Django error page also shows the local variables when DEBUG is set to True.

valentijnscholten avatar Jan 24 '21 20:01 valentijnscholten