Package modules :: Module contacts_google :: 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 the Google Contacts backend

Instance Methods [hide private]
 
__init__(self, modulesString, config, configsection, folder, verbose=False, soft=False)
Constructor
source code
 
_unpackGoogleTitle(self, atts, gtitle)
Takes the components of a Google Title apart (all names)
source code
 
_unpackPostalCity(self, line)
Takes one address line apart and identifies postal code and locality
source code
 
_unpackGooglePostalAddress(self, atts, addressText, type)
Takes the components of a Google address apart
source code
 
load(self)
Load all data from backend
source code
 
_assembleTitle(self, contactEntry)
Assembles all information from a contact entry for the packed version of a title in google contacts
source code
 
_savePhones(self, contact, new_contact)
Integrates all saving tranformations for phone attributes
source code
 
_saveAddresses(self, contact, new_contact)
Integrates all saving tranformations for address attributes
source code
 
_saveBusinessDetails(self, c, new_contact)
Creates an entry for business organzation und unit.
source code
 
_saveOperationAdd(self, id)
Save all changes to Google contacts that have come by
source code
 
_saveOperationDelete(self, id)
Finally deletes the contact entry identified by its ID in the google contact backend
source code
 
_saveOperationModify(self, id)
Applies changes for an entry to the Google contacts backend
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. The connection to the Google Gdata backend is established.

Parameters:
  • modulesString - is a small string to help you make a unique id. It is the two modules configuration-names concatinated.
  • config - is the configuration from ~/.pisi/conf. Use like config.get(configsection,'user')
  • configsection - is the configuration from ~/.pisi/conf. Use like config.get(configsection,'user')
  • folder - is a string with the location for where your module can save its own files if necessary
  • verbose - should make your module "talk" more
  • soft - should tell you if you should make changes (ie. save)
Overrides: pisiinterfaces.AbstractSynchronizationModule.__init__

_unpackGoogleTitle(self, atts, gtitle)

source code 

Takes the components of a Google Title apart (all names)

The whole thing is about guessing - check code for details.

_unpackPostalCity(self, line)

source code 

Takes one address line apart and identifies postal code and locality

This is really tricky - you never know how many parts belong to which side - and it's all in one line. We do it this way:

  • only one item indicates city only
  • two items one each
  • more than two - depending on the length of the first item, another item is applied to the postal code; all the remaining stuff is city

_unpackGooglePostalAddress(self, atts, addressText, type)

source code 

Takes the components of a Google address apart

The whole thing is about guessing - check code for details.

load(self)

source code 

Load all data from backend

A single query is performed and the result set is parsed afterwards.

_saveOperationModify(self, id)

source code 

Applies changes for an entry to the Google contacts backend

In order to keep things simple the old value is simply erased using the method _saveOperationDelete and a new one is inserted (_saveOperationAdd).

saveModifications(self)

source code 

Save whatever changes have come by

The _history variable is iterated. The corresponding function is called for each action.