Commit 2dbcddd7 authored by Ayush Tiwari's avatar Ayush Tiwari

Jupyter: Use mime_type from content_result before displaying anything from frontend.

This fix is for bug https://nexedi.erp5.net/bug_module/20160212-76EAAC/view?ignore_layout:int=1
where the image base64 string was only shoeing. The error in this case was that the mime_type
of content code_result was not being updated by the kernel before display.

Reported by : @ivan
parent 34c35a0b
......@@ -43,7 +43,7 @@ md5sum = d7d4a7e19d55bf14007819258bf42100
[erp5-kernel]
<= download-file-base
filename = ERP5kernel.py.jinja
md5sum = 3dfc6a7c16828bff55dec4cf96b730d3
md5sum = eb07520fc189dcac2d3bd2db1368b1ba
[kernel-json]
<= download-file-base
......
......@@ -265,7 +265,25 @@ class ERP5Kernel(Kernel):
mime_type = 'text/plain'
try:
content = json.loads(self.response)
# Example format for the json result we are expecting is :
# content = {
# "status": "ok",
# "ename": null,
# "evalue": null,
# "traceback": null,
# "code_result": "",
# "mime_type": "text/plain"
# }
# So, we can easily use any of the key to update values as such.
# Getting code_result for succesfull execution of code
code_result = content['code_result']
# Update mime_type with the mime_type from the http response result
# Required in case the mime_type is anything other than 'text/plain'
mime_type = content['mime_type']
# Display to frontend the error message for content status as 'error'
if content['status']=='error':
reply_content = {
......
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