Commit 66539348 authored by Yusei Tahara's avatar Yusei Tahara

Jupyter: Add extra_data_list option to support display data similar to the...

Jupyter: Add extra_data_list option to support display data similar to the original jupyter python backend.
parent 0f62d562
......@@ -43,7 +43,7 @@ md5sum = d7d4a7e19d55bf14007819258bf42100
[erp5-kernel]
<= download-file-base
filename = ERP5kernel.py.jinja
md5sum = a0d13f4f5a9cd22a7b5d2c901aa9faae
md5sum = b3737a0e753055cc2f9ccd9610d0e2bb
[kernel-json]
<= download-file-base
......
......@@ -214,6 +214,8 @@ class ERP5Kernel(Kernel):
# Remove spaces and newlines from both ends of code
code = code.strip()
extra_data_list = []
if code.startswith('%'):
# No need to try-catch here as its already been taken that the code
# starts-with '%', so we'll get magic_name, no matter what be after '%'
......@@ -279,6 +281,8 @@ class ERP5Kernel(Kernel):
# Required in case the mime_type is anything other than 'text/plain'
mime_type = content['mime_type']
extra_data_list = content.get('extra_data_list', [])
# Display to frontend the error message for content status as 'error'
if content['status']=='error':
reply_content = {
......@@ -309,6 +313,9 @@ class ERP5Kernel(Kernel):
'metadata': {}}
self.send_response(self.iopub_socket, 'display_data', data)
for extra_data in extra_data_list:
self.send_response(self.iopub_socket, 'display_data', extra_data)
reply_content = {
'status': status,
# The base class increments the execution count
......
......@@ -566,6 +566,9 @@ eggs = ${neoppod:eggs}
# Needed for parsing .po files from our Localizer subset
polib
# Used by ERP5 Jupyter backend
ipykernel
# parameterizing the version of the generated python interpreter name by the
# python section version causes dependency between this egg section and the
# installation of python, which we don't want on an instance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment