Esempio n. 1
0
def respond_array(struct_type):
    if struct_type == "array":
        array = request.get_array(field_name='file')
        return jsonify({"result": array})
    elif struct_type == "dict":
        adict = request.get_dict(field_name='file')
        return jsonify({"result": adict})
    elif struct_type == "records":
        records = request.get_records(field_name='file')
        return jsonify({"result": records})
    elif struct_type == "book":
        book = request.get_book(field_name='file')
        return jsonify({"result": book.to_dict()})
    elif struct_type == "book_dict":
        book_dict = request.get_book_dict(field_name='file')
        return jsonify({"result": book_dict})
Esempio n. 2
0
def upload_array(struct_type):
    if struct_type == "array":
        array = request.get_array(field_name='file')
        return excel.make_response_from_array(array, 'xls')
    elif struct_type == "dict":
        adict = request.get_dict(field_name='file')
        return excel.make_response_from_dict(adict, 'xls')
    elif struct_type == "records":
        records = request.get_records(field_name='file')
        return excel.make_response_from_records(records, 'xls')
    elif struct_type == "book":
        book = request.get_book(field_name='file')
        return excel.make_response(book, 'xls')
    elif struct_type == "book_dict":
        book_dict = request.get_book_dict(field_name='file')
        return excel.make_response_from_book_dict(book_dict, 'xls')
Esempio n. 3
0
def upload_array(struct_type):
    if struct_type == "array":
        array = request.get_array(field_name="file")
        return excel.make_response_from_array(array,
                                              "xls",
                                              sheet_name="test_array")
    elif struct_type == "dict":
        adict = request.get_dict(field_name="file")
        return excel.make_response_from_dict(adict,
                                             "xls",
                                             sheet_name="test_array")
    elif struct_type == "records":
        records = request.get_records(field_name="file")
        return excel.make_response_from_records(records,
                                                "xls",
                                                sheet_name="test_array")
    elif struct_type == "book":
        book = request.get_book(field_name="file")
        return excel.make_response(book, "xls")
    elif struct_type == "book_dict":
        book_dict = request.get_book_dict(field_name="file")
        return excel.make_response_from_book_dict(book_dict, "xls")