Package s3 :: Module s3import :: Class S3BulkImporter
[frames] | no frames]

Class S3BulkImporter

source code

object --+
         |
        S3BulkImporter

Import CSV files of data to pre-populate the database. Suitable for use in Testing, Demos & Simulations

http://eden.sahanafoundation.org/wiki/DeveloperGuidelines/PrePopulate

Instance Methods
 
__init__(self)
Constructor
source code
 
load_descriptor(self, path)
Load the descriptor file and then all the import tasks in that file into the task property.
source code
 
extract_csv_import_line(self, path, details)
Extract the details for a CSV Import Task
source code
 
extract_other_import_line(self, path, details)
Store a single import job into the tasks property *,function,filename,*extraArgs
source code
 
execute_import_task(self, task)
Execute each import job, in order
source code
 
execute_special_task(self, task)
Execute import tasks which require a custom function, such as import_role
source code
 
import_role(self, filename)
Import Roles from CSV
source code
 
import_user(self, filename)
Import Users from CSV with an import Prep
source code
 
import_feed(self, filename)
Import RSS Feeds from CSV with an import Prep
source code
 
import_image(self, filename, tablename, idfield, imagefield)
Import images, such as a logo or person image
source code
 
import_font(self, url)
Install a Font
source code
 
import_remote_csv(self, url, prefix, resource, stylesheet)
Import CSV files from remote servers
source code
 
import_task(self, task_name, args_json=None, vars_json=None)
Import a Scheduled Task
source code
 
import_xml(self, filepath, prefix, resourcename, dataformat, source_type=None)
Import XML data using an XSLT: static/formats/<dataformat>/import.xsl Setting the source_type is possible
source code
 
perform_tasks(self, path)
Load and then execute the import jobs that are listed in the descriptor file (tasks.cfg)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
import_script(filename)
Run a custom Import Script
source code
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

Constructor

Overrides: object.__init__

load_descriptor(self, path)

source code 

Load the descriptor file and then all the import tasks in that file into the task property. The descriptor file is the file called tasks.cfg in path. The file consists of a comma separated list of: module, resource name, csv filename, xsl filename.

extract_csv_import_line(self, path, details)

source code 

Extract the details for a CSV Import Task

extract_other_import_line(self, path, details)

source code 

Store a single import job into the tasks property *,function,filename,*extraArgs

execute_import_task(self, task)

source code 

Execute each import job, in order

execute_special_task(self, task)

source code 

Execute import tasks which require a custom function, such as import_role

import_role(self, filename)

source code 

Import Roles from CSV

import_user(self, filename)

source code 

Import Users from CSV with an import Prep

import_feed(self, filename)

source code 

Import RSS Feeds from CSV with an import Prep

import_image(self, filename, tablename, idfield, imagefield)

source code 

Import images, such as a logo or person image

filename a CSV list of records and filenames tablename the name of the table idfield the field used to identify the record imagefield the field to where the image will be added

Example: bi.import_image ("org_logos.csv", "org_organisation", "name", "logo") and the file org_logos.csv may look as follows id file Sahana Software Foundation sahanalogo.jpg American Red Cross icrc.gif

import_font(self, url)

source code 

Install a Font

import_remote_csv(self, url, prefix, resource, stylesheet)

source code 

Import CSV files from remote servers

import_script(filename)
Static Method

source code 

Run a custom Import Script

To Do: Report Errors during Script run to console better

import_task(self, task_name, args_json=None, vars_json=None)

source code 

Import a Scheduled Task

import_xml(self, filepath, prefix, resourcename, dataformat, source_type=None)

source code 

Import XML data using an XSLT: static/formats/<dataformat>/import.xsl Setting the source_type is possible

perform_tasks(self, path)

source code 

Load and then execute the import jobs that are listed in the descriptor file (tasks.cfg)