Commit 5a0d4baf authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_data_notebook bt5: Add exception handling while serializing result

parent f807b0b6
...@@ -61,12 +61,9 @@ ...@@ -61,12 +61,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n <value> <string>import json\n
import json\n
\n \n
selection_id = \'python_shell_selection\'\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
portal_selections = portal.portal_selections\n
\n \n
# The boolean values via requests are received as \n # The boolean values via requests are received as \n
request_reference = {\'True\': True, \'False\': False}.get(request_reference, False)\n request_reference = {\'True\': True, \'False\': False}.get(request_reference, False)\n
...@@ -129,9 +126,20 @@ result = {\n ...@@ -129,9 +126,20 @@ result = {\n
u\'status\': status\n u\'status\': status\n
}\n }\n
\n \n
data_notebook_message.edit(notebook_code_result=code_result)\n try:\n
\n serialized_result = json.dumps(result)\n
return json.dumps(result)\n data_notebook_message.edit(notebook_code_result=code_result)\n
except UnicodeDecodeError:\n
result = {\n
u\'code_result\': None,\n
u\'ename\': u\'UnicodeDecodeError\',\n
u\'evalue\': None,\n
u\'traceback\': None,\n
u\'status\': u\'error\'\n
}\n
serialized_result = json.dumps(result)\n
\n
return serialized_result\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
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