diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..c7d5d42 --- /dev/null +++ b/settings.py @@ -0,0 +1 @@ +DEBUG = False diff --git a/shell.py b/shell.py index 05ac3d7..f4eca61 100755 --- a/shell.py +++ b/shell.py @@ -65,6 +65,7 @@ from sympy import srepr, sstr, pretty, latex import detectmobile +import settings PRINTERS = { 'repr': srepr, @@ -766,14 +767,21 @@ def post(self): 'session': str(session_key), 'output': 'Error: Operation timed out.' } - except Exception, e: - errmsg = '\n'.join([ - 'Exception in SymPy Live of type ', - str(type(e)), - 'for reference the last 5 stack trace entries are', - traceback.format_exc(5) - ]) + if settings.DEBUG: + errmsg = '\n'.join([ + 'Exception in SymPy Live of type ', + str(type(e)), + 'for reference the stack trace is', + traceback.format_exc() + ]) + else: + errmsg = '\n'.join([ + 'Exception in SymPy Live of type ', + str(type(e)), + 'for reference the last 5 stack trace entries are', + traceback.format_exc(5) + ]) result = { 'session': str(session_key), 'output': errmsg