def delete_bot(bot_id): """Delete an bot object""" bot = BotModel.get_by_id(bot_id) try: bot.delete() flash(u'Bot %s successfully deleted.' % bot.bot_username, 'success') return redirect(url_for('list_bots')) except CapabilityDisabledError: flash(u'App Engine Datastore is currently in read-only mode.', 'info') return redirect(url_for('list_bots'))