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

Class S3ImportItem

source code

object --+
         |
        S3ImportItem

Class representing an import item (=a single record)

Instance Methods
 
__init__(self, job)
Constructor
source code
 
__repr__(self)
Helper method for debugging
source code
 
parse(self, element, original=None, table=None, tree=None, files=None)
Read data from a <resource> element
source code
 
deduplicate(self)
Detect whether this is an update or a new record
source code
 
authorize(self)
Authorize the import of this item, sets self.permitted
source code
 
validate(self)
Validate this item (=record onvalidation), sets self.accepted
source code
 
commit(self, ignore_errors=False)
Commit this item to the database
source code
 
store(self, item_table=None)
Store this item in the DB
source code
 
restore(self, row)
Restore an item from a item table row.
source code

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

Class Variables
  METHOD = Storage(CREATE= "create", UPDATE= "update", DELETE= "...
  POLICY = Storage(THIS= "THIS", OTHER= "OTHER", NEWER= "NEWER",...
Properties

Inherited from object: __class__

Method Details

__init__(self, job)
(Constructor)

source code 

Constructor

Parameters:
  • job - the import job this item belongs to
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

Helper method for debugging

Overrides: object.__repr__

parse(self, element, original=None, table=None, tree=None, files=None)

source code 

Read data from a <resource> element

Parameters:
  • element - the element
  • table - the DB table
  • tree - the import tree
  • files - uploaded files
Returns:
True if successful, False if not (sets self.error)

deduplicate(self)

source code 

Detect whether this is an update or a new record

authorize(self)

source code 

Authorize the import of this item, sets self.permitted

validate(self)

source code 

Validate this item (=record onvalidation), sets self.accepted

commit(self, ignore_errors=False)

source code 

Commit this item to the database

Parameters:
  • ignore_errors - skip invalid components (still reports errors)

store(self, item_table=None)

source code 

Store this item in the DB

restore(self, row)

source code 

Restore an item from a item table row. This does not restore the references (since this can not be done before all items are restored), must call job.restore_references() to do that

Parameters:
  • row - the item table row

Class Variable Details

METHOD

Value:
Storage(CREATE= "create", UPDATE= "update", DELETE= "delete", MERGE= "\
merge")

POLICY

Value:
Storage(THIS= "THIS", OTHER= "OTHER", NEWER= "NEWER", MASTER= "MASTER"\
)