import_utils

Utility classes to import files into Camelot

class camelot.view.import_utils.RowData(row_number, row_data)[source]

Class representing the data in a single row of the imported file as an object with attributes column_1, column_2, ..., each representing the data in a single column of that row.

since the imported file might contain less columns than expected, the RowData object returns None for not existing attributes

class camelot.view.import_utils.RowDataAdminDecorator(object_admin)[source]

Decorator that transforms the Admin of the class to be imported to an Admin of the RowData objects to be used when previewing and validating the data to be imported.

based on the field attributes of the original mode, it will turn the background color pink if the data is invalid for being imported.

create_validator(model)[source]

Creates a validator that validates the data to be imported, the validator will check if the background of the cell is pink, and if it is it will mark that object as invalid.

flush(obj)[source]

When flush is called, don’t do anything, since we’ll only save the object when importing them for real

class camelot.view.import_utils.UTF8Recoder(f, encoding)[source]

Iterator that reads an encoded stream and reencodes the input to UTF-8.

class camelot.view.import_utils.UnicodeReader(f, dialect=<class csv.excel at 0xcdeeadc>, encoding='utf-8', **kwds)[source]

A CSV reader which will iterate over lines in the CSV file “f”, which is encoded in the given encoding.

class camelot.view.import_utils.XlsReader(filename)[source]

Read an XLS file and iterator over its lines

Previous topic

forms

Next topic

main

This Page