'@param authors: A list of authors.'

def set_authors(self, id, authors):

    self.conn.execute('DELETE    FROM    books_authors_link    WHERE    book=?', (id,))
    for a in authors:
        if (not a):
            continue
        a = a.strip()
        author = self.conn.get('SELECT    id    from    authors    WHERE    name=?', (a,), all=False)
        if author:
            aid = author
            self.conn.execute('UPDATE    authors    SET    name=?    WHERE    id=?', (a, aid))
        else:
            aid = self.conn.execute('INSERT    INTO    authors(name)    VALUES    (?)', (a,)).lastrowid
        try:
            self.conn.execute('INSERT    INTO    books_authors_link(book,    author)    VALUES    (?,?)', (id, aid))
        except sqlite.IntegrityError:
            pass
    self.conn.commit()
