Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Markup object repr in debug console #1393

Merged
merged 2 commits into from Nov 16, 2018

Conversation

ChrisDryden
Copy link
Contributor

@ChrisDryden ChrisDryden commented Nov 12, 2018

The console was assuming that all objects of string type would only return a string in repr(). This meant that objects that gave response of its object type along with a string in repr were breaking parts of the code that removed the parenthesis. By verifying that an object is a string type instead of a string instance this bug can be fixed.

Fixes #1129

@ChrisDryden
Copy link
Contributor Author

This fixes issue #1129

Copy link
Member

@ThiefMaster ThiefMaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once you remove that trailing whitespace

werkzeug/debug/repr.py Outdated Show resolved Hide resolved
@ThiefMaster
Copy link
Member

Also, please amend the commit message to be more concise - first line shouldn't be more than 51 chars, and certainly so long that github truncates it. My suggestion would be something like "Fix Markup object repr in debugger"

@davidism davidism changed the title Added check to verify that the string_type Fix Markup object repr in debug console Nov 15, 2018
@davidism
Copy link
Member

I'd like to experiment a little more before merging this. This fix works, but now it ignores subclasses of str that still have the standard repr.

@davidism
Copy link
Member

Demo of some alternatives in #1397

@davidism
Copy link
Member

I ended up committing a different fix that still allows subclasses. Thanks for working on this during the sprints, just digging in and figuring out where things were happening and why was really helpful.

New version collapses the repr rather than slicing the original object, then only adds subclass info if the repr looks like the standard string repr.

@davidism davidism added this to the 0.15 milestone Nov 16, 2018
@davidism davidism merged commit 96d8b23 into pallets:master Nov 16, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debugger garbles markupsafe.Markup() repr
3 participants