(slug,
                                          http_status_code=None, **assignment)
return decorate
A version of the requires_privilege decorator which returns an
    HttpResponse object with HTTP Status Code of 412 by default and
    content_type of tex/plain if the privilege is not found.
A version of the requires_privilege decorator which returns an
    HttpResponse object with HTTP Status Code of 412 by default and
    content_type of tex/plain if the privilege is not found.
A version of the requires_privilege decorator which returns an HttpResponse object with HTTP Status Code of 412 by default and content_type of tex / plain if the privilege is not found .
def requires_privilege_plaintext_response(slug,
                                          http_status_code=None, **assignment):
    """
    A version of the requires_privilege decorator which returns an
    HttpResponse object with HTTP Status Code of 412 by default and
    content_type of tex/plain if the privilege is not found.
    """
    def decorate(fn):
        @wraps(fn)
        def wrapped(request, *args, **kwargs):
            try:
                return requires_privilege(slug, **assignment)(fn)(
                    request, *args, **kwargs
                )
            except PermissionDenied:
                return HttpResponse(
                    "You have lost access to this feature.",
                    status=http_status_code or 412, content_type="text/plain",
                )
        return wrapped
    return decorate
def requires_privilege_plaintext_response ( slug , http_status_code = None , * * assignment ) : def decorate ( fn ) : @ wraps ( fn ) def wrapped ( request , * args , * * kwargs ) : try : return requires_privilege ( slug , * * assignment ) ( fn ) ( request , * args , * * kwargs ) except PermissionDenied : return HttpResponse ( "You have lost access to this feature." , status = http_status_code or 412 , content_type = "text/plain" , ) return wrapped return decorate