141
141
(r"/clusters/%s" % _profile_regex, ClusterProfileHandler),
144
# Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
145
# base_project_url will always be unicode, which will in turn
146
# make the patterns unicode, and ultimately result in unicode
147
# keys in kwargs to handler._execute(**kwargs) in tornado.
148
# This enforces that base_project_url be ascii in that situation.
150
# Note that the URLs these patterns check against are escaped,
151
# and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'.
152
base_project_url = py3compat.unicode_to_str(base_project_url, 'ascii')
144
154
if os.path.exists("/usr/share/javascript/mathjax/MathJax.js"):
145
155
handlers.append((r"/mathjax/(.*)", web.StaticFileHandler,
146
156
{"path": "/usr/share/javascript/mathjax"}))
149
159
template_path=os.path.join(os.path.dirname(__file__), "templates"),
150
160
static_path=os.path.join("/usr/share/ipython/notebook/static"),
151
161
cookie_secret=os.urandom(1024),
162
login_url="%s/login"%(base_project_url.rstrip('/')),
155
165
# allow custom overrides for the tornado web app.
156
166
settings.update(settings_overrides)
158
# Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
159
# base_project_url will always be unicode, which will in turn
160
# make the patterns unicode, and ultimately result in unicode
161
# keys in kwargs to handler._execute(**kwargs) in tornado.
162
# This enforces that base_project_url be ascii in that situation.
164
# Note that the URLs these patterns check against are escaped,
165
# and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'.
166
base_project_url = py3compat.unicode_to_str(base_project_url, 'ascii')
168
168
# prepend base_project_url onto the patterns that we match
169
169
new_handlers = []
170
170
for handler in handlers: