Show More
@@ -10,6 +10,7 b' from tornado import web' | |||||
10 | from ...base.handlers import IPythonHandler, json_errors |
|
10 | from ...base.handlers import IPythonHandler, json_errors | |
11 | from IPython.utils.jsonutil import date_default |
|
11 | from IPython.utils.jsonutil import date_default | |
12 | from IPython.html.utils import url_path_join, url_escape |
|
12 | from IPython.html.utils import url_path_join, url_escape | |
|
13 | from IPython.kernel.kernelspec import NoSuchKernel | |||
13 |
|
14 | |||
14 |
|
15 | |||
15 | class SessionRootHandler(IPythonHandler): |
|
16 | class SessionRootHandler(IPythonHandler): | |
@@ -52,7 +53,11 b' class SessionRootHandler(IPythonHandler):' | |||||
52 | if sm.session_exists(name=name, path=path): |
|
53 | if sm.session_exists(name=name, path=path): | |
53 | model = sm.get_session(name=name, path=path) |
|
54 | model = sm.get_session(name=name, path=path) | |
54 | else: |
|
55 | else: | |
55 | model = sm.create_session(name=name, path=path, kernel_name=kernel_name) |
|
56 | try: | |
|
57 | model = sm.create_session(name=name, path=path, kernel_name=kernel_name) | |||
|
58 | except NoSuchKernel: | |||
|
59 | raise web.HTTPError(400, "No such kernel: %s" % kernel_name) | |||
|
60 | ||||
56 | location = url_path_join(self.base_url, 'api', 'sessions', model['id']) |
|
61 | location = url_path_join(self.base_url, 'api', 'sessions', model['id']) | |
57 | self.set_header('Location', url_escape(location)) |
|
62 | self.set_header('Location', url_escape(location)) | |
58 | self.set_status(201) |
|
63 | self.set_status(201) |
General Comments 0
You need to be logged in to leave comments.
Login now