示例#1
0
文件: postgres.py 项目: efphe/mother
    def _connect(self):

        Speaker.log_insane('Initializing postgres connection...')
        try:
            s= _PostgresInfo._connect_str()
            self.connection= psycopg2.connect(s)
            self.cursor= self.connection.cursor()
        except Exception, ss:
            Speaker.log_raise('Unable to establish a connection '
                    'with the database: %s', ERR_COL(ss), 
                    BrokenConnection)
示例#2
0
文件: sqlite.py 项目: efphe/mother
    def _connect(self):

        Speaker.log_insane('Initializing sqlite connection (db = %s)...', 
                INF_COL(_SqliteInfo.dbfile))
        dbfile= _SqliteInfo.dbfile

        try:
            self.connection= apsw.Connection(dbfile)
            self.cursor= self.connection.cursor()
        except Exception, ss:
            Speaker.log_raise('Unable to establish a connection '
                    'with the database: %s', ERR_COL(ss), 
                    BrokenConnection)
示例#3
0
文件: postgres.py 项目: efphe/mother
 def _close(self):
 	Speaker.log_insane("Closing Connection...")
     try:
         self.connection.close()
     except:
         pass