cn_db.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:cosa-nostra 作者: joxeankoret 项目源码 文件源码
def get_dbn(cfg_file = "config.cfg"):
  parser = ConfigParser.SafeConfigParser()
  parser.optionxform = str
  cn_db_file = os.getenv("CN_DB")
  if cn_db_file is not None:
    print "*** USING DATABASE", cn_db_file
    cfg_file = cn_db_file
  parser.read(cfg_file)

  section = 'database'
  if 'database' not in parser.sections():
    raise Exception("No database section in " + cfg_file)

  return parser.get(section, 'dbn')

#-----------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号