I'm trying to filter out sensitive informations using Django's @sensitive_post_parameters
. I thought prepending these annotations over a the few specific fonctions would be enough, but it doesn't work. I've set breakpoint inside SafeExceptionReporterFilter
and it only breaks when being called from the AdminEmailHandler
and not the other handlers. What am I missing ?
You can write a custom Handler that uses django.views.debug.ExceptionReporter
to format the exception.
Example use of ExceptionReporter
:
from django.views.debug import ExceptionReporter
# exc_type, exc_value, traceback are a standard exception
# tuple as returned by sys.exc_info
reporter = ExceptionReporter(request, exc_type, exc_value, traceback)
html_report = reporter.get_traceback_html()
text_report = reporter.get_traceback_text()
ExceptionReporter
will use the ExceptionReporterFilter
defined by the DEFAULT_EXCEPTION_REPORTER_FILTER
setting which by default is SafeExceptionReporterFilter
.
Have a look at AdminEmailHandler
's implementation to get info on how to create a custom Handler
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With