#!/usr/bin/python # -*- coding:utf-8 -*- import sys,os,time import ConfigParser from _util import DEFAULT_DB_CONFIG_PATH class Config: def __init__(self): self.path = DEFAULT_DB_CONFIG_PATH self.cf = ConfigParser.ConfigParser() self.cf.read(self.path) def get(self, field, key): result = "" try: result = self.cf.get(field, key) except: result = "" return result def set(self, filed, key, value): try: self.cf.set(field, key, value) cf.write(open(self.path,'w')) except: return False return True