Added another catcher for an KeyError in the request participants callback

This commit is contained in:
Dennis Potter 2019-02-02 16:25:32 +01:00
parent 2b488ee1f8
commit c46a4f6012
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF

View File

@ -282,53 +282,56 @@ class Plugin:
room.send_html(self.messages['info_event_id_err']) room.send_html(self.messages['info_event_id_err'])
return return
# Set header try:
html_message = self.messages['event_participants_head'].format( # Set header
len(self.adm.events[id_event].getAllAttend()), html_message = self.messages['event_participants_head'].format(
self.adm.events[id_event].number_of_guests, len(self.adm.events[id_event].getAllAttend()),
self.adm.events[id_event].name) self.adm.events[id_event].number_of_guests,
self.adm.events[id_event].name)
# Attend # Attend
html_message += "<br />" html_message += "<br />"
html_message += self.messages['event_participants_attend']; html_message += self.messages['event_participants_attend'];
# Loop through fetched participants # Loop through fetched participants
html_message += "<ul>" html_message += "<ul>"
for member in self.adm.events[id_event].getAllAttend(): for member in self.adm.events[id_event].getAllAttend():
html_message += "<li>" html_message += "<li>"
html_message += member[1].username html_message += member[1].username
html_message += "</li>" html_message += "</li>"
html_message += "</ul>" html_message += "</ul>"
# Maybe # Maybe
html_message += self.messages['event_participants_maybe']; html_message += self.messages['event_participants_maybe'];
# Loop through fetched participants # Loop through fetched participants
html_message += "<ul>" html_message += "<ul>"
for member in self.adm.events[id_event].getAllMaybe(): for member in self.adm.events[id_event].getAllMaybe():
html_message += "<li>" html_message += "<li>"
html_message += member[1].username html_message += member[1].username
html_message += "</li>" html_message += "</li>"
html_message += "</ul>" html_message += "</ul>"
# Not attend # Not attend
html_message += self.messages['event_participants_not_attend']; html_message += self.messages['event_participants_not_attend'];
# Loop through fetched participants # Loop through fetched participants
html_message += "<ul>" html_message += "<ul>"
for member in self.adm.events[id_event].getAllNotAttend(): for member in self.adm.events[id_event].getAllNotAttend():
html_message += "<li>" html_message += "<li>"
html_message += member[1].username html_message += member[1].username
html_message += "</li>" html_message += "</li>"
html_message += "</ul>" html_message += "</ul>"
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): def chat_callback(self, room, event):
room.send_text("Chat") room.send_text("Chat")