def append(self, tweet):
        """Add a tweet to the end of the list."""
        c = self.connection.cursor()

        last_tweet = c.execute("SELECT tweet from tweetlist where label='last_tweet'").next()[0]

        c.execute("INSERT INTO tweets(message,  previous_tweet, next_tweet) VALUES (?,?,NULL)", (tweet, last_tweet))
        tweet_id = c.lastrowid

        # Set the current tweet as the last tweet
        c.execute("UPDATE tweetlist SET tweet=? WHERE label='last_tweet'", (tweet_id,))

        # If there was no last_tweet, there was no first_tweet
        # so make this the first tweet
        if last_tweet is None:
            c.execute("UPDATE tweetlist SET tweet=? WHERE label='first_tweet'", (tweet_id,))
        else:
            # Update the last tweets reference to this one
            c.execute("UPDATE tweets SET next_tweet = ? WHERE id= ? ", (tweet_id, last_tweet))

        self.connection.commit()
        c.close()
Add a tweet to the end of the list.