Skip to content

Fix Markup object repr in debug console#1393

Merged
davidism merged 2 commits intopallets:masterfrom
ChrisDryden:1129-markupsafe
Nov 16, 2018
Merged

Fix Markup object repr in debug console#1393
davidism merged 2 commits intopallets:masterfrom
ChrisDryden:1129-markupsafe

Conversation

@ChrisDryden
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

This fixes issue #1129

@davidism davidism requested a review from ThiefMaster November 12, 2018 19:41
Copy link
Copy Markdown
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

@ThiefMaster
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Demo of some alternatives in #1397

@davidism
Copy link
Copy Markdown
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