From c46a4f6012be11c61e086571abfb1ec28cdc884a Mon Sep 17 00:00:00 2001 From: Dennis Potter Date: Sat, 2 Feb 2019 16:25:32 +0100 Subject: [PATCH] Added another catcher for an KeyError in the request participants callback --- plugins/admidio_events/admidio_events.py | 71 ++++++++++++------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/plugins/admidio_events/admidio_events.py b/plugins/admidio_events/admidio_events.py index dba3d09..44c601a 100644 --- a/plugins/admidio_events/admidio_events.py +++ b/plugins/admidio_events/admidio_events.py @@ -282,53 +282,56 @@ class Plugin: room.send_html(self.messages['info_event_id_err']) return - # Set header - html_message = self.messages['event_participants_head'].format( - len(self.adm.events[id_event].getAllAttend()), - self.adm.events[id_event].number_of_guests, - self.adm.events[id_event].name) + try: + # Set header + html_message = self.messages['event_participants_head'].format( + len(self.adm.events[id_event].getAllAttend()), + self.adm.events[id_event].number_of_guests, + self.adm.events[id_event].name) - # Attend - html_message += "
" - html_message += self.messages['event_participants_attend']; + # Attend + html_message += "
" + html_message += self.messages['event_participants_attend']; - # Loop through fetched participants - html_message += "" - # Maybe - html_message += self.messages['event_participants_maybe']; + # Maybe + html_message += self.messages['event_participants_maybe']; - # Loop through fetched participants - html_message += "" - # Not attend - html_message += self.messages['event_participants_not_attend']; + # Not attend + html_message += self.messages['event_participants_not_attend']; - # Loop through fetched participants - html_message += "" - room.send_html(html_message) + room.send_html(html_message) + except KeyError: + room.send_html(self.messages['unknown_event']) def chat_callback(self, room, event): room.send_text("Chat")