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

Ensure handler patterns are str, not unicode #1368

Merged
merged 1 commit into from Feb 6, 2012

Conversation

minrk
Copy link
Member

@minrk minrk commented Feb 2, 2012

Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and base_project_url will always be unicode, which will in turn make the patterns unicode, and ultimately result in unicode keys in kwargs to handler._execute(**kwargs) in tornado (by way of re.match.groupdict()). This enforces that base_project_url be ascii, which it always should be anyway.

Note that the URLs these patterns check against are escaped, and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'.

If you actually use u'héllo' in your regex, it will not match the URLs you think it should.

Bug introduced by PR #1332

closes #1360

Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
base_project_url will always be unicode, which will in turn
make the patterns unicode, and ultimately result in unicode
keys in kwargs to handler._execute(**kwargs) in tornado.
This enforces that base_project_url be ascii in that situation.

Note that the URLs these patterns check against are escaped,
and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'.

If you actually use u'héllo' in your regex, it will not match the URLs
you think it should.
@ellisonbg ellisonbg closed this Feb 6, 2012
ellisonbg added a commit that referenced this pull request Feb 6, 2012
Ensure handler patterns are str, not unicode
@ellisonbg ellisonbg merged commit 725b9a1 into ipython:master Feb 6, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Ensure handler patterns are str, not unicode
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.

IPython notebook not starting on winXP
2 participants