(table_ids, domain, task, download_id, owner_id)
return expose_cached_download(
        file.getvalue(),
        60 * 60 * 2,
        file_extension=".xlsx",
        mimetype=Format.from_format(format).mimetype,
        content_disposition='attachment; filename="%s_lookup-tables.xlsx"' % domain,
        download_id=download_id,
        owner_ids=[owner_id],
    )
Prepare fixture data for Excel download
Prepare fixture data for Excel download
Prepare fixture data for Excel download
def prepare_fixture_download(table_ids, domain, task, download_id, owner_id):
    """Prepare fixture data for Excel download
    """
    data_types_book, excel_sheets = _prepare_fixture(table_ids, domain, task=task)

    header_groups = [("types", excel_sheets["types"]["headers"])]
    value_groups = [("types", excel_sheets["types"]["rows"])]
    for data_type in data_types_book:
        header_groups.append((data_type.tag, excel_sheets[data_type.tag]["headers"]))
        value_groups.append((data_type.tag, excel_sheets[data_type.tag]["rows"]))

    file = io.BytesIO()
    format = Format.XLS_2007
    export_raw(tuple(header_groups), tuple(value_groups), file, format)
    return expose_cached_download(
        file.getvalue(),
        60 * 60 * 2,
        file_extension=".xlsx",
        mimetype=Format.from_format(format).mimetype,
        content_disposition='attachment; filename="%s_lookup-tables.xlsx"' % domain,
        download_id=download_id,
        owner_ids=[owner_id],
    )
def prepare_fixture_download ( table_ids , domain , task , download_id , owner_id ) : data_types_book , excel_sheets = _prepare_fixture ( table_ids , domain , task = task ) header_groups = [ ( "types" , excel_sheets [ "types" ] [ "headers" ] ) ] value_groups = [ ( "types" , excel_sheets [ "types" ] [ "rows" ] ) ] for data_type in data_types_book : header_groups . append ( ( data_type . tag , excel_sheets [ data_type . tag ] [ "headers" ] ) ) value_groups . append ( ( data_type . tag , excel_sheets [ data_type . tag ] [ "rows" ] ) ) file = io . BytesIO ( ) format = Format . XLS_2007 export_raw ( tuple ( header_groups ) , tuple ( value_groups ) , file , format ) return expose_cached_download ( file . getvalue ( ) , 60 * 60 * 2 , file_extension = ".xlsx" , mimetype = Format . from_format ( format ) . mimetype , content_disposition = 'attachment; filename="%s_lookup-tables.xlsx"' % domain , download_id = download_id , owner_ids = [ owner_id ] , )