Package modules :: Module contacts_dummy
[hide private]
[frames] | no frames]

Source Code for Module modules.contacts_dummy

 1  """ 
 2  A dummy to make a new module (here for contacts) 
 3   
 4  This file is part of Pisi. 
 5   
 6  Pisi is free software: you can redistribute it and/or modify 
 7  it under the terms of the GNU General Public License as published by 
 8  the Free Software Foundation, either version 3 of the License, or 
 9  (at your option) any later version. 
10   
11  Pisi is distributed in the hope that it will be useful, 
12  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  GNU General Public License for more details. 
15   
16  You should have received a copy of the GNU General Public License 
17  along with Pisi.  If not, see <http://www.gnu.org/licenses/>. 
18  """ 
19   
20  from contacts import contacts 
21  from pisiconstants import * 
22  import pisiprogress 
23   
24 -class SynchronizationModule(contacts.AbstractContactSynchronizationModule):
25 - def __init__( self, modulesString, config, configsection, folder, verbose=False, soft=False):
26 """ 27 Constructor 28 29 Super class constructor (L{contacts.AbstractContactSynchronizationModule.__init__}) is called. 30 Local variables are initialized. 31 The settings from the configuration file are loaded. 32 33 @param modulesString: is a small string to help you make a unique id. It is the two modules configuration-names concatinated. 34 @param config: is the configuration from ~/.pisi/conf. Use like config.get(configsection,'user') 35 @param configsection: is the configuration from ~/.pisi/conf. Use like config.get(configsection,'user') 36 @param folder: is a string with the location for where your module can save its own files if necessary 37 @param verbose: should make your module "talk" more 38 @param soft: should tell you if you should make changes (ie. save) 39 """ 40 contacts.AbstractContactSynchronizationModule.__init__(self, verbose, soft, modulesString, config, configsection, "Contacts DUMMY") 41 self.verbose = verbose 42 pisiprogress.getCallback().verbose("Dummy module loaded")
43 44 # pull configuration data and whatever initialization might be required 45
46 - def load(self):
47 """ 48 Load all data from backend 49 """ 50 pass # implementation goes here
51
52 - def saveModifications( self ):
53 """ 54 Save whatever changes have come by 55 """ 56 for listItem in self._history: 57 action = listItem[0] 58 id = listItem[1] 59 if action == ACTIONID_ADD: 60 pisiprogress.getCallback().verbose("\t\t<dummy> adding %s" %(id)) 61 pass # implementation goes here 62 elif action == ACTIONID_DELETE: 63 pisiprogress.getCallback().verbose("\t\t<dummy> deleting %s" %(id)) 64 pass # implementation goes here 65 elif action == ACTIONID_MODIFY: 66 pisiprogress.getCallback().verbose("\t\t<dummy> replacing %s" %(id)) 67 pass # implementation goes here
68