##// END OF EJS Templates
ensure replies from ipkernel are clean for JSON
MinRK -
Show More
@@ -303,6 +303,7 b' class Kernel(Configurable):'
303 time.sleep(self._execute_sleep)
303 time.sleep(self._execute_sleep)
304
304
305 # Send the reply.
305 # Send the reply.
306 reply_content = json_clean(reply_content)
306 reply_msg = self.session.send(self.shell_socket, u'execute_reply',
307 reply_msg = self.session.send(self.shell_socket, u'execute_reply',
307 reply_content, parent, ident=ident)
308 reply_content, parent, ident=ident)
308 self.log.debug(str(reply_msg))
309 self.log.debug(str(reply_msg))
@@ -321,6 +322,7 b' class Kernel(Configurable):'
321 matches = {'matches' : matches,
322 matches = {'matches' : matches,
322 'matched_text' : txt,
323 'matched_text' : txt,
323 'status' : 'ok'}
324 'status' : 'ok'}
325 matches = json_clean(matches)
324 completion_msg = self.session.send(self.shell_socket, 'complete_reply',
326 completion_msg = self.session.send(self.shell_socket, 'complete_reply',
325 matches, parent, ident)
327 matches, parent, ident)
326 self.log.debug(str(completion_msg))
328 self.log.debug(str(completion_msg))
@@ -358,6 +360,7 b' class Kernel(Configurable):'
358 else:
360 else:
359 hist = []
361 hist = []
360 content = {'history' : list(hist)}
362 content = {'history' : list(hist)}
363 content = json_clean(content)
361 msg = self.session.send(self.shell_socket, 'history_reply',
364 msg = self.session.send(self.shell_socket, 'history_reply',
362 content, parent, ident)
365 content, parent, ident)
363 self.log.debug(str(msg))
366 self.log.debug(str(msg))
@@ -409,7 +412,7 b' class Kernel(Configurable):'
409 sys.stdout.flush()
412 sys.stdout.flush()
410
413
411 # Send the input request.
414 # Send the input request.
412 content = dict(prompt=prompt)
415 content = json_clean(dict(prompt=prompt))
413 msg = self.session.send(self.stdin_socket, u'input_request', content, parent)
416 msg = self.session.send(self.stdin_socket, u'input_request', content, parent)
414
417
415 # Await a response.
418 # Await a response.
General Comments 0
You need to be logged in to leave comments. Login now