Ejemplo n.º 1
0
 def load_conf(self):
     try:
         conf = FileUtility.readFile(self.conf).replace("\r", "")
         exec conf
         gl = locals()
         for var in self.conf_vars.keys():
             if gl.has_key(var):
                 self.conf_vars[var] = gl[var]
         ## patch xiti_home, because run as daemon, which need full path
         if 'xiti_home' in self.conf_vars:
             xiti_home = self.conf_vars['xiti_home']
             conf_path, pf = os.path.split(self.conf)
             if not os.path.isabs(xiti_home):
                 xiti_home = os.path.normpath(os.path.join(conf_path, xiti_home))
                 self.conf_vars['xiti_home'] = xiti_home
         self.xiti_conf = [ ["" ,  self.conf_vars['xiti_conf'] ] ]
         del self.conf_vars['xiti_conf']
     except Exception, e:
         print e
Ejemplo n.º 2
0
	def __init__(self, filePath):
		self.filePath = filePath
		readData = FileUtility.readFile(filePath)
		self.height = MerkleTree.getHeightOfMerkleTree(self.filePath, MerkleTree.DEFAULT_CHUNK_SIZE)
		print "filePath: " + self.filePath + " Length: " + str(len(readData)) + " Height: " + str(self.height)
		self.buildTree(readData)