예제 #1
0
 def readConfig(self, filename):
     '''Reads the configuration file.
     @param filename: the name of the configuration file
     '''
     config = Config(filename)
     mode = config.get('copy.mode')
     if mode:
         if mode.find('add'):
             self._addNonExisting = True
         if mode.find('size'):
             self._copyDifferentSize = True
         if mode.find('update'):
             self._copyNewer = True
         if mode.find('delete'):
             self._deleteFilesWithoutSource = True
     mode = config.get('copy.mode.removed')
     if mode:
         if mode.find('add'):
             self._addNonExisting = False
         if mode.find('size'):
             self._copyDifferentSize = False
         if mode.find('update'):
             self._copyNewer = False
         if mode.find('delete'):
             self._deleteFilesWithoutSource = False
     maxDepth = config.get('maxDepth')
     if maxDepth != None:
         self._maxDepth = int(maxDepth)
     verbose = config.get('verboseLevel')
     if verbose != None:
         self._verboseLevel = int(verbose)
예제 #2
0
    def testConfig(self):
        conf1 = self._temp + "reutil1.conf"
        conf2 = self._temp + "reutil2.conf"
        Util.writeFile(conf1, '''
include "%s"
value.conf1=True
'''         % conf2)
        Util.writeFile(conf2, '''
value.conf2=4711
'''         )
        conf = Config(conf1)
        self.assertEquals(None, conf.get('NotExistingKey'))
        self.assertEquals('True', conf.get('value.conf1'))
        self.assertEquals('4711', conf.get('value.conf2'))
        os.unlink(conf1)
        os.unlink(conf2)