# Author: Zhang Huangbin import os, sys, time import web from libs import iredutils cfg = web.iredconfig session = web.config.get('_session') ################################### # Initialize database connection. # class AmavisdWrap: def __init__(self, app=web.app, session=session, **settings): try: self.db = web.database( dbn='mysql', db=cfg.amavisd.get('db', 'policyd'), user=cfg.amavisd.get('user', 'policyd'), passwd=cfg.amavisd.get('passwd'), charset='utf8', ) self.db.supports_multiple_insert = True except Exception, e: return (False, str(e))