Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
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()
Пример #4
0
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()
Пример #5
0
def methodNotAllowedHandler(errorString):
    return handleException(exceptions.MethodNotAllowedException())