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

Fixed String representation of objects with keys that have spaces #4

Merged
merged 3 commits into from
Nov 3, 2015

Conversation

odedbadt
Copy link

@odedbadt odedbadt commented Nov 3, 2015

Fixes #3

args = ', '.join(['%s=%r' % (key, self[key]) for key in keys])
return '%s(%s)' % (self.__class__.__name__, args)
if any(" " in k for k in keys):
dict_content = ', '.join(["'%s': %r" % (key, self[key]) for key in keys])
Copy link

Choose a reason for hiding this comment

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

This still has issues with keys containing quotes etc. %s is bound to fail here, and I think %r is better...

vmalloc added a commit that referenced this pull request Nov 3, 2015
Fixed String representation of objects with keys that have spaces
@vmalloc vmalloc merged commit 1d0473b into master Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants