(
    func: Callable[[WSGIRequest], Optional[HttpResponse]]
)
return wraps(func)(_decorator)
A decorator that makes sure that only the admin changes a setting.
A decorator that makes sure that only the admin changes a setting.
A decorator that makes sure that only the admin changes a setting .
def control(
    func: Callable[[WSGIRequest], Optional[HttpResponse]]
) -> Callable[[WSGIRequest], HttpResponse]:
    """A decorator that makes sure that only the admin changes a setting."""

    def _decorator(request: WSGIRequest) -> HttpResponse:
        if not user_manager.is_admin(request.user):
            return HttpResponseForbidden()
        response = func(request)
        update_state()
        if response is not None:
            return response
        return HttpResponse()

    return wraps(func)(_decorator)
def control ( func : Callable [ [ WSGIRequest ] , Optional [ HttpResponse ] ] ) -> Callable [ [ WSGIRequest ] , HttpResponse ] : def _decorator ( request : WSGIRequest ) -> HttpResponse : if not user_manager . is_admin ( request . user ) : return HttpResponseForbidden ( ) response = func ( request ) update_state ( ) if response is not None : return response return HttpResponse ( ) return wraps ( func ) ( _decorator )