(func: Callable)
return wraps(func)(_decorator)
A decorator for functions that control the lights.
    Every control changes the views state and returns an empty response.
    Mod privileges are required to control the lights.
A decorator for functions that control the lights.
    Every control changes the views state and returns an empty response.
    Mod privileges are required to control the lights.
A decorator for functions that control the lights . Every control changes the views state and returns an empty response . Mod privileges are required to control the lights .
def control(func: Callable) -> Callable:
    """A decorator for functions that control the lights.
    Every control changes the views state and returns an empty response.
    Mod privileges are required to control the lights."""

    def _decorator(request: WSGIRequest) -> HttpResponse:
        if not user_manager.has_controls(request.user):
            return HttpResponseForbidden()

        response = func(request)
        lights.update_state()
        if response is not None:
            return response
        return HttpResponse()

    return wraps(func)(_decorator)
def control ( func : Callable ) -> Callable : def _decorator ( request : WSGIRequest ) -> HttpResponse : if not user_manager . has_controls ( request . user ) : return HttpResponseForbidden ( ) response = func ( request ) lights . update_state ( ) if response is not None : return response return HttpResponse ( ) return wraps ( func ) ( _decorator )