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 })
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 } )
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
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
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
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