importwizard

Module for managing imports

class camelot.view.wizard.importwizard.CsvCollectionGetter(filename)[source]

Returns data from csv file as a list of RowData objects

class camelot.view.wizard.importwizard.DataPreviewPage(parent=None, model=None, collection_getter=None)[source]

DataPreviewPage is the previewing page for the import wizard

initializePage()[source]

Gets all info needed from SelectFilePage and feeds table

class camelot.view.wizard.importwizard.FinalPage(parent=None, model=None, admin=None)[source]

FinalPage is the final page in the import process

class camelot.view.wizard.importwizard.ImportWizard(parent=None, admin=None)[source]

ImportWizard provides a two-step wizard for importing data as objects into Camelot. To create a custom wizard, subclass this ImportWizard and overwrite its class attributes.

To import a different file format, you probably need a custom collection_getter for this file type.

add_pages(model, admin)[source]

Add all pages to the import wizard, reimplement this method to add custom pages to the wizard. This method is called in the __init__ method, to add all pages to the wizard.

Parameters:model – the CollectionProxy that will be used to display the to

be imported data :param admin: the admin of the destination data

collection_getter

alias of CsvCollectionGetter

data_preview_page

alias of DataPreviewPage

final_page

alias of FinalPage

rowdata_admin_decorator

alias of RowDataAdminDecorator

select_file_page

alias of SelectFilePage

class camelot.view.wizard.importwizard.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.wizard.importwizard.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.wizard.importwizard.UTF8Recoder(f, encoding)[source]

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

class camelot.view.wizard.importwizard.UnicodeReader(f, dialect=<class csv.excel at 0xd0731ac>, 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.wizard.importwizard.XlsCollectionGetter(filename, encoding='utf-8')[source]

Returns the data from excel file as a list of RowData objects

Previous topic

backup

Next topic

merge_document

This Page


Comments
blog comments powered by Disqus