##// END OF EJS Templates
Ensure handler patterns are str, not unicode...
MinRK -
Show More
@@ -1,10 +1,10 b''
1 # coding: utf-8
1 """A tornado based IPython notebook server.
2 """A tornado based IPython notebook server.
2
3
3 Authors:
4 Authors:
4
5
5 * Brian Granger
6 * Brian Granger
6 """
7 """
7
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9 # Copyright (C) 2008-2011 The IPython Development Team
9 # Copyright (C) 2008-2011 The IPython Development Team
10 #
10 #
@@ -65,6 +65,7 b' from IPython.zmq.ipkernel import ('
65 IPKernelApp
65 IPKernelApp
66 )
66 )
67 from IPython.utils.traitlets import Dict, Unicode, Integer, List, Enum, Bool
67 from IPython.utils.traitlets import Dict, Unicode, Integer, List, Enum, Bool
68 from IPython.utils import py3compat
68
69
69 #-----------------------------------------------------------------------------
70 #-----------------------------------------------------------------------------
70 # Module globals
71 # Module globals
@@ -130,6 +131,16 b' class NotebookWebApplication(web.Application):'
130 # allow custom overrides for the tornado web app.
131 # allow custom overrides for the tornado web app.
131 settings.update(settings_overrides)
132 settings.update(settings_overrides)
132
133
134 # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
135 # base_project_url will always be unicode, which will in turn
136 # make the patterns unicode, and ultimately result in unicode
137 # keys in kwargs to handler._execute(**kwargs) in tornado.
138 # This enforces that base_project_url be ascii in that situation.
139 #
140 # Note that the URLs these patterns check against are escaped,
141 # and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'.
142 base_project_url = py3compat.unicode_to_str(base_project_url, 'ascii')
143
133 # prepend base_project_url onto the patterns that we match
144 # prepend base_project_url onto the patterns that we match
134 new_handlers = []
145 new_handlers = []
135 for handler in handlers:
146 for handler in handlers:
General Comments 0
You need to be logged in to leave comments. Login now