def _sdb(self, dbname, **kw): self._dbname = dbname try: get_db(dbname) close_db(dbname) except: pass # TODO: Pull this out into some kind of config? self.db = setup_db(dbname, database=dbname, user=kw.get('dbuser', 'vumi'), password=kw.get('dbpassword', 'vumi')) return self.db.runQuery("SELECT 1")
def _cb(_): close_db(self._dbname) self.db = None