コード例 #1
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def api_collections_route_a_x_y(handle, collection):

    if ('rq' not in request.args) and ('method' not in request.args):
        result = rings_dispatcher('_a',
                                  handle,
                                  api=True,
                                  collection=collection)
    elif request.method == 'POST':
        if 'method' in request.args:
            if request.args.get('method').lower() == 'put':
                result = collection_dispatcher('_a_x_y',
                                               handle,
                                               api=True,
                                               collection=collection)
            elif request.args.get('method').lower() == 'post':
                result = rings_dispatcher('_a',
                                          handle,
                                          api=True,
                                          collection=collection)
        else:
            result = rings_dispatcher('_a',
                                      handle,
                                      api=True,
                                      collection=collection)

    elif 'rq' in request.args:
        if request.args.get('rq').lower() == 'put':
            result = collection_dispatcher('_a_x_y',
                                           handle,
                                           api=True,
                                           collection=collection)
        if request.args.get('rq').lower() == 'post':
            result = rings_dispatcher('_a',
                                      handle,
                                      api=True,
                                      collection=collection)

    else:
        #Every collection specific GET
        result = collection_dispatcher('_a_x_y',
                                       handle,
                                       api=True,
                                       collection=collection)

    if 'redirect' in result:
        return redirect(result['redirect'])
    else:
        return result
コード例 #2
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def api_route_a(handle):

    result = rings_dispatcher('_a', handle, api=True)

    if 'redirect' in result:
        return redirect(result['redirect'])
    else:
        return result
コード例 #3
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def api_route_a_b(handle, ring):

    result = rings_dispatcher('_a_b', handle, ring, api=True)

    #if 'redirect' in result:
    #   return redirect(result['redirect'])
    #else:
    #   return result

    return result
コード例 #4
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def collections_route_a_x_y(handle, collection):
    '''
    Administrative functions only. No data
    '''

    if ('rq' not in request.args) and ('method' not in request.args):

        #result = rings_dispatcher('_a',handle,collection=collection)
        #We are assuming that not having a collection specific page is ok?
        return redirect(
            url_for('avispa_rest.home',
                    handle=handle,
                    _external=True,
                    _scheme=URL_SCHEME))

    elif request.method == 'POST':
        if 'method' in request.args:
            if request.args.get('method').lower() == 'put':
                # Put the Collection metadata
                result = collection_dispatcher('_a_x_y', handle, collection)
            elif request.args.get('method').lower() == 'post':
                # Post the Ring
                result = rings_dispatcher('_a', handle, collection=collection)
        else:
            # Post the ring
            result = rings_dispatcher('_a', handle, collection=collection)

    elif 'rq' in request.args:
        if request.args.get('rq').lower() == 'put':
            # Show the form to Edit the Collection metadata
            result = collection_dispatcher('_a_x_y', handle, collection)
        if request.args.get('rq').lower() == 'post':
            # Get the Ring Modeler
            result = rings_dispatcher('_a', handle, collection=collection)

    else:
        #Every collection specific GET
        result = collection_dispatcher('_a_x_y', handle, collection)

    if 'redirect' in result:
        return redirect(result['redirect'])
    else:
        return result
コード例 #5
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def route_a_b(handle, ring):

    if 'collection' in request.args:
        collection = request.args.get('collection')
    else:
        collection = False

    result = rings_dispatcher('_a_b', handle, ring, collection=collection)

    if 'redirect' in result:
        return redirect(result['redirect'])
    else:
        return result
コード例 #6
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def route_a(handle):

    if request.method == 'GET':
        if ('rq' not in request.args) and ('method' not in request.args):
            return redirect(
                url_for('avispa_rest.home',
                        handle=handle,
                        _external=True,
                        _scheme=URL_SCHEME))

    if 'collection' in request.args:
        collection = request.args.get('collection')
    else:
        collection = False

    result = rings_dispatcher('_a', handle, collection=collection)

    if 'redirect' in result:
        return redirect(result['redirect'])
    else:
        return result
コード例 #7
0
ファイル: routes.py プロジェクト: gcid12/Rings_backend
def api_route_a_b_c(handle, ring, idx):

    result = rings_dispatcher('_a_b_c', handle, ring, idx, api=True)

    return result