diff --git a/castellum/settings/default/base.py b/castellum/settings/default/base.py index d1ee8557d49a17b439985692706e6023a02c8772..c174fccc97491cf6d6766614c258f59ca9f6083c 100644 --- a/castellum/settings/default/base.py +++ b/castellum/settings/default/base.py @@ -113,6 +113,8 @@ LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/' LOGIN_URL = '/login/' +DEFAULT_EXCEPTION_REPORTER = 'castellum.utils.debug.ExceptionReporter' + # Internationalization USE_I18N = True USE_L10N = True diff --git a/castellum/utils/debug.py b/castellum/utils/debug.py new file mode 100644 index 0000000000000000000000000000000000000000..c6935a45137aa61062462bcb65c5932466bca4a7 --- /dev/null +++ b/castellum/utils/debug.py @@ -0,0 +1,37 @@ +# (c) 2018-2022 MPIB , +# 2018-2019 MPI-CBS , +# 2018-2019 MPIP +# +# This file is part of Castellum. +# +# Castellum is free software; you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Castellum is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with Castellum. If not, see +# . + +from django.views import debug + +ALLOWED_KEYS = [ + 'is_email', + 'unicode_hint', + 'frames', + 'request', + 'exception_type', + 'exception_value', + 'lastframe', +] + + +class ExceptionReporter(debug.ExceptionReporter): + def get_traceback_data(self): + data = super().get_traceback_data() + return {key: data[key] for key in ALLOWED_KEYS if key in data}