示例#1
0
def _check_export_size(domain, export_instances, export_filters):
    count = 0
    for instance in export_instances:
        count += get_export_size(instance, export_filters)
    if count > MAX_EXPORTABLE_ROWS and not PAGINATED_EXPORTS.enabled(domain):
        raise ExportAsyncException(
            _("This export contains %(row_count)s rows. Please change the "
              "filters to be less than %(max_rows)s rows.") % {
                  'row_count': count,
                  'max_rows': MAX_EXPORTABLE_ROWS
              })
示例#2
0
def _check_export_size(domain, export_instances, export_filters):
    count = 0
    for instance in export_instances:
        count += get_export_size(instance, export_filters)
    if count > MAX_EXPORTABLE_ROWS and not PAGINATED_EXPORTS.enabled(domain):
        raise ExportAsyncException(
            _("This export contains %(row_count)s rows. Please change the "
              "filters to be less than %(max_rows)s rows.") % {
                'row_count': count,
                'max_rows': MAX_EXPORTABLE_ROWS
            }
        )
示例#3
0
def get_export_writer(export_instances, allow_pagination=True):
    """
    Return a new _Writer
    """
    format = Format.XLS_2007
    if len(export_instances) == 1:
        format = export_instances[0].export_format

    legacy_writer = get_writer(format)
    if allow_pagination and PAGINATED_EXPORTS.enabled(export_instances[0].domain):
        writer = _PaginatedExportWriter(legacy_writer)
    else:
        writer = _ExportWriter(legacy_writer)
    return writer
示例#4
0
def _get_writer(export_instances):
    """
    Return a new _Writer
    """
    format = Format.XLS_2007
    if len(export_instances) == 1:
        format = export_instances[0].export_format

    legacy_writer = get_writer(format)
    if PAGINATED_EXPORTS.enabled(export_instances[0].domain):
        writer = _PaginatedWriter(legacy_writer)
    else:
        writer = _Writer(legacy_writer)
    return writer
示例#5
0
def get_export_writer(export_instances, temp_path, allow_pagination=True):
    """
    Return a new _Writer
    """
    format = Format.XLS_2007
    if len(export_instances) == 1:
        format = export_instances[0].export_format

    legacy_writer = get_writer(format)
    if allow_pagination and PAGINATED_EXPORTS.enabled(export_instances[0].domain):
        writer = _PaginatedExportWriter(legacy_writer, temp_path)
    else:
        writer = _ExportWriter(legacy_writer, temp_path)
    return writer
示例#6
0
def get_export_writer(export_instances, temp_path, allow_pagination=True):
    """
    Return a new _Writer
    """
    format = Format.XLS_2007
    format_data_in_excel = False

    if len(export_instances) == 1:
        format = export_instances[0].export_format
        format_data_in_excel = export_instances[0].format_data_in_excel

    legacy_writer = get_writer(format, use_formatted_cells=format_data_in_excel)

    if allow_pagination and PAGINATED_EXPORTS.enabled(export_instances[0].domain):
        writer = _PaginatedExportWriter(legacy_writer, temp_path)
    else:
        writer = _ExportWriter(legacy_writer, temp_path)

    return writer