コード例 #1
0
def initPostDb():
	#get db connection info from config file
	xmlDomObj = cf.openConf(cm.DB_CONF)
	dbName = cf.getConfigByParam(xmlDomObj, 'postgresql', 'db_name')
	dbUser = cf.getConfigByParam(xmlDomObj, 'postgresql', 'db_user')
	dbPassword = cf.getConfigByParam(xmlDomObj, 'postgresql', 'db_password')
	connStr = "dbname=%s user=%s password=%s" % (dbName, dbUser, dbPassword)
	cm.POST_CONN = psycopg2.connect(connStr)
	cm.POST_CURSOR = cm.POST_CONN.cursor()
コード例 #2
0
def _loadConfig(conf, module):
	xmlDomObj = cf.openConf(conf)	
	#Get each config values
	for key in cm.dtas_conf.keys():
		val = cf.getConfigByParam(xmlDomObj, module, key)
		cm.dtas_conf[key] = val
	print cm.dtas_conf