def respond_if_blocked(context, request): """ Set 410 Gone and construct response if resource is deleted or hidden. Otherwise or it request method is 'options' or 'put' return None """ if request.method not in ['HEAD', 'GET', 'POST']: return block_reason = get_reason_if_blocked(context) if block_reason is not None: raise HTTPGone(detail=block_reason)
def respond_if_blocked(context, request): """ Set 410 Gone and construct response if resource is deleted or hidden. Otherwise or it request method is 'options' or 'put' return None """ from adhocracy_core.utils import get_reason_if_blocked if request.method not in ['HEAD', 'GET', 'POST']: return block_reason = get_reason_if_blocked(context) if block_reason is not None: raise HTTPGone(detail=block_reason)
def respond_if_blocked(context, request): """ Set 410 Gone and construct response if resource is deleted or hidden. Otherwise or it request method is 'options' or 'put' return None """ from adhocracy_core.utils import get_reason_if_blocked if request.method not in ["HEAD", "GET", "POST"]: return block_reason = get_reason_if_blocked(context) if block_reason is not None: raise HTTPGone(detail=block_reason)
def etag_blocked(context: IResource, request: IRequest) -> str: """Return `resource` blocked status.""" reason = get_reason_if_blocked(context) return str(reason)
def _validate_visibility(context: IResource, request: IRequest): if request.method not in ['HEAD', 'GET', 'POST']: return block_reason = get_reason_if_blocked(context) if block_reason is not None: raise HTTPGone(detail=block_reason)