def handleFlaskListRequest(id_, flaskRequest, endpoint): """ Handles the specified flask list request for one of the GET URLs. Invokes the specified endpoint to generate a response. """ if flaskRequest.method == "GET": return handleList(id_, endpoint, flaskRequest) else: raise exceptions.MethodNotAllowedException()
def handleFlaskPostRequest(flaskRequest, endpoint): """ Handles the specified flask request for one of the POST URLS Invokes the specified endpoint to generate a response. """ if flaskRequest.method == "POST": return handleHttpPost(flaskRequest, endpoint) elif flaskRequest.method == "OPTIONS": return handleHttpOptions() else: raise exceptions.MethodNotAllowedException()
def handleFlaskGetRequest(version, id_, flaskRequest, endpoint): """ Handles the specified flask request for one of the GET URLs at the specified version. Invokes the specified endpoint to generate a response. """ assertCorrectVersion(version) if flaskRequest.method == "GET": return handleHttpGet(id_, endpoint) else: raise exceptions.MethodNotAllowedException()
def handleFlaskPostRequest(version, flaskRequest, endpoint): """ Handles the specified flask request for one of the POST URLS at at the specified version. Invokes the specified endpoint to generate a response. """ if Version.parseString(version) != Version.parseString(protocol.version): raise exceptions.VersionNotSupportedException() if flaskRequest.method == "POST": return handleHttpPost(flaskRequest, endpoint) elif flaskRequest.method == "OPTIONS": return handleHttpOptions() else: raise exceptions.MethodNotAllowedException()
def methodNotAllowedHandler(errorString): return handleException(exceptions.MethodNotAllowedException())