Fix some HTTP status codes in sessions API

Thomas Kluyver 13 years ago committed by MinRK
parent b3d2698c11
commit 693cc97905

@ -63,6 +63,7 @@ class SessionRootHandler(IPythonHandler):
kernel_id = km.start_kernel(cwd=nbm.notebook_dir)
model = sm.create_session(name=name, path=path, kernel_id=kernel_id, ws_url=self.ws_url)
self.set_header('Location', '{0}/api/sessions/{1}'.format(self.base_project_url, model['id']))
self.set_status(201)
self.finish(json.dumps(model, default=date_default))
class SessionHandler(IPythonHandler):

@ -133,7 +133,7 @@ class SessionManager(LoggingConfigurable):
if reply is not None:
model = self.reply_to_dictionary_model(reply)
else:
model = None
raise web.HTTPError(404, u'Session not found: %s=%r' % (column, value))
return model
def update_session(self, session_id, **kwargs):
@ -151,8 +151,6 @@ class SessionManager(LoggingConfigurable):
and the value replaces the current value in the session
with session_id.
"""
column = kwargs.keys() # uses only the first kwarg that is entered
value = kwargs.values()
for kwarg in kwargs:
try:
self.cursor.execute("UPDATE session SET %s=? WHERE id=?" %kwarg, (kwargs[kwarg], session_id))

Loading…
Cancel
Save