'Sets the open database (or None) and filename'

def _set_db(self, newv):

    (db, dbfilename) = newv
    if self._db:
        self._db.close()
        self._db = None
    self._db = db
    self.dbfilename = dbfilename
