a try.. except ... rollback ... else commit is more natural here.