コード例 #1
0
ファイル: endpoints.py プロジェクト: edvorkin/eve
def item_endpoint(url, **lookup):
    """ Item endpoint handler

    :param url: the url that led here
    :param lookup: the query

    .. versionchanged:: 0.0.7
       Using 'utils.request_method' helper function now.

    .. versionchanged:: 0.0.6
       Support for HEAD requests
    """
    resource = config.RESOURCES[url]
    response = None
    method = request_method()
    if method in ('GET', 'HEAD'):
        response = getitem(resource, **lookup)
    elif method == 'PATCH':
        response = patch(resource, **lookup)
    elif method == 'DELETE':
        response = delete(resource, **lookup)
    elif method == 'OPTIONS':
        send_response(resource, response)
    else:
        abort(405)
    return send_response(resource, response)
コード例 #2
0
ファイル: endpoints.py プロジェクト: bcattle/eve
def item_endpoint(url, **lookup):
    """ Item endpoint handler

    :param url: the url that led here
    :param lookup: the query

    .. versionchanged:: 0.0.7
       Using 'utils.request_method' helper function now.

    .. versionchanged:: 0.0.6
       Support for HEAD requests
    """
    resource = config.RESOURCES[url]
    response = None
    method = request_method()
    if method in ('GET', 'HEAD'):
        response = getitem(resource, **lookup)
    elif method == 'PATCH':
        response = patch(resource, **lookup)
    elif method == 'DELETE':
        response = delete(resource, **lookup)
    elif method == 'OPTIONS':
        send_response(resource, response)
    else:
        abort(405)
    return send_response(resource, response)
コード例 #3
0
ファイル: endpoints.py プロジェクト: Tefnet/eve
def item_endpoint(url, **lookup):
    """ Item endpoint handler

    :param url: the url that led here
    :param lookup: the query
    """
    resource = config.RESOURCES[url]
    response = None
    if request.method == 'GET':
        response = getitem(resource, **lookup)
    elif request.method == 'PATCH' or (
            request.method == 'POST'
            and request.headers.get('X-HTTP-Method-Override')):
        response = patch(resource, **lookup)
    elif request.method == 'DELETE':
        response = delete(resource, **lookup)
    elif request.method == 'POST':
        # We are supporting PATCH via POST with X-HTTP-Method-Override (see
        # above), therefore we must explicitly handle this case.
        abort(405)
    return send_response(resource, response)
コード例 #4
0
ファイル: endpoints.py プロジェクト: Tefnet/eve
def item_endpoint(url, **lookup):
    """ Item endpoint handler

    :param url: the url that led here
    :param lookup: the query
    """
    resource = config.RESOURCES[url]
    response = None
    if request.method == 'GET':
        response = getitem(resource, **lookup)
    elif request.method == 'PATCH' or (request.method == 'POST' and
                                       request.headers.get(
                                           'X-HTTP-Method-Override')):
        response = patch(resource, **lookup)
    elif request.method == 'DELETE':
        response = delete(resource, **lookup)
    elif request.method == 'POST':
        # We are supporting PATCH via POST with X-HTTP-Method-Override (see
        # above), therefore we must explicitly handle this case.
        abort(405)
    return send_response(resource, response)