I think the problem could be that after you insert or delete you have to commit the query by running connection.commit().
http://mysql-python.sourceforge.net/...ection-objects
I could be wrong as I have never used MySQLdb but it might be worth a shot
edit: check this out
http://mysql-python.sourceforge.net/...-won-t-go-away
it says that MySQLdb disabled autocommits in version 1.2.0 so you will have to run the connection.commit() before you close the connection or all changes will not be committed to the db.