def flush_last_row(writer, row, last_row, choices): """ :writer: csv writer :row: dictionary of row data :last_row: dictionary of data from the last row :choices: list of choices :return: last_order_number, choices """ last_row['choices_string'] = convert_choices(choices) last_order_number = row['order'] last_row['field_type'] = u'choice' writerow(writer, last_row) choices = [] return last_order_number, choices
def flush_row(writer, row, schema_name, schema_title, publish_date): """ :writer: csv writer :row: dictionary of row data :schema_name: system name of the schema :schema_title: human readable name of the schema :publish_date: publish date of the schema :return: last_order_number, last_row, row, first_choice_row """ writerow(writer, row) last_order_number = row['order'] last_row = dict(row) row = init_row(schema_name, schema_title, publish_date) first_choice_row = True return last_order_number, last_row, row, first_choice_row