Commit 84012adb authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_data_notebook bt5: Add transaction abort and fail loudly in case of error...

erp5_data_notebook bt5: Add transaction abort and fail loudly in case of error in transaction script
parent 9d713deb
...@@ -7,6 +7,7 @@ from Products.ERP5Type.Globals import PersistentMapping ...@@ -7,6 +7,7 @@ from Products.ERP5Type.Globals import PersistentMapping
import sys import sys
import traceback import traceback
import transaction
def Base_compileJupyterCode(self, jupyter_code, old_local_variable_dict): def Base_compileJupyterCode(self, jupyter_code, old_local_variable_dict):
""" """
...@@ -60,7 +61,10 @@ def Base_compileJupyterCode(self, jupyter_code, old_local_variable_dict): ...@@ -60,7 +61,10 @@ def Base_compileJupyterCode(self, jupyter_code, old_local_variable_dict):
sys.stdout = old_stdout sys.stdout = old_stdout
result_string = result.getvalue() result_string = result.getvalue()
# Catching exception to show it to jupyter frontend
except Exception: except Exception:
# Abort transaction in case of error in script
transaction.abort()
etype, evalue, tb = sys.exc_info() etype, evalue, tb = sys.exc_info()
tb_list = traceback.format_exception(etype, evalue, tb) tb_list = traceback.format_exception(etype, evalue, tb)
status = u'error' status = u'error'
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W: 46, 18: Use of eval (eval-used)</string> <string>W: 47, 18: Use of eval (eval-used)</string>
<string>W: 59, 6: Use of exec (exec-used)</string> <string>W: 60, 6: Use of exec (exec-used)</string>
</tuple> </tuple>
</value> </value>
</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