#18923: Decorator sensitive_post_parameters does not work with class method ------------------------------+-------------------------------------- Reporter: zbohm | Owner: nobody Type: Bug | Status: closed Component: contrib.auth | Version: 1.4 Severity: Normal | Resolution: invalid Keywords: | Triage Stage: Unreviewed Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ------------------------------+-------------------------------------- Changes (by zbohm):
* status: new => closed * resolution: => invalid Comment: It is possible to use `method_decorator`. I have used it the wrong way in the previous case. {{{ #!diff diff --git a/tests/regressiontests/views/views.py b/tests/regressiontests/views/views.py index 17872ee..4e99d12 100644 --- a/tests/regressiontests/views/views.py +++ b/tests/regressiontests/views/views.py @@ -11,6 +11,7 @@ from django.views.debug import technical_500_response, SafeExceptionReporterFilt from django.views.decorators.debug import (sensitive_post_parameters, sensitive_variables) from django.utils.log import getLogger +from django.utils.decorators import method_decorator from . import BrokenException, except_args @@ -212,7 +213,7 @@ def custom_exception_reporter_filter_view(request): class Klass(object): - @sensitive_variables('sauce') + @method_decorator(sensitive_variables('sauce')) def method(self, request): # Do not just use plain strings for the variables' values in the code # so that the tests don't return false positives when the function's @@ -226,7 +227,7 @@ class Klass(object): send_log(request, exc_info) return technical_500_response(request, *exc_info) - @sensitive_post_parameters("password", "secret-key") + @method_decorator(sensitive_post_parameters("password", "secret- key")) def method_post(self, request): request.method = 'POST' request.POST._mutable = True }}} -- Ticket URL: <https://code.djangoproject.com/ticket/18923#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.