Package modules :: Module contacts_vcf :: Class SynchronizationModule
[hide private]
[frames] | no frames]

Class SynchronizationModule

source code

      pisiinterfaces.AbstractSynchronizationModule --+    
                                                     |    
contacts.contacts.AbstractContactSynchronizationModule --+
                                                         |
                                                        SynchronizationModule

The implementation of the interface contacts.AbstractContactSynchronizationModule for VCF file persistence backend

Instance Methods [hide private]
 
__init__(self, modulesString, config, configsection, folder, verbose=False, soft=False)
Constructor
source code
 
_promptFilename(self, prompt, default=None, description=None)
Asks for user input on console
source code
 
_guessAmount(self)
Try to determine roughly how many entries are in this file (we can't know prior to parsing; but we have a guess using the file size)
source code
 
load(self)
Load all data from local VCF file
source code
 
_checkForMandatoryFields(self)
Checks each entry, whether all mandatory fields are available.
source code
 
saveModifications(self)
Save whatever changes have come by
source code

Inherited from contacts.contacts.AbstractContactSynchronizationModule: addContact, allContacts, flush, getContact, removeContact, replaceContact

Inherited from pisiinterfaces.AbstractSynchronizationModule: addEntry, allEntries, getDescription, getEntry, getName, postProcess, preProcess, prettyPrint, removeEntry, replaceEntry

Instance Variables [hide private]
Method Details [hide private]

__init__(self, modulesString, config, configsection, folder, verbose=False, soft=False)
(Constructor)

source code 

Constructor

Super class constructor (contacts.AbstractContactSynchronizationModule.__init__) is called. Local variables are initialized. The settings from the configuration file are loaded.

Overrides: pisiinterfaces.AbstractSynchronizationModule.__init__

load(self)

source code 

Load all data from local VCF file

File opened and the entries are parsed. For each entry a contacts.contacts.Contact instance is created and stored in the instance dictionary contacts.AbstractContactSynchronizationModule._allContacts.

_checkForMandatoryFields(self)

source code 

Checks each entry, whether all mandatory fields are available.

Delegates request to vobjecttools.

saveModifications(self)

source code 

Save whatever changes have come by

We first make a backup of the old file. Then, the entire set of information is dumped into a new file. (I hope, you don't mind the order of your entries). Thereby, we shouldn't create entries from the scratch when they were not changed in the meantime (in the likely case of PISI not supporting all fields within the VCF format and file).