From efb3965d7689fbd5acfe46a7b1405adf60f289bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 17 Jan 2019 18:20:51 +0100 Subject: [PATCH] Fixed calendar action can create "empty" actions --- server/src/uds/REST/methods/services_pool_calendars.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/uds/REST/methods/services_pool_calendars.py b/server/src/uds/REST/methods/services_pool_calendars.py index 91007ce7c..afe7d00bf 100644 --- a/server/src/uds/REST/methods/services_pool_calendars.py +++ b/server/src/uds/REST/methods/services_pool_calendars.py @@ -136,7 +136,7 @@ class ActionsCalendars(DetailHandler): 'calendarId': item.calendar.uuid, 'calendar': item.calendar.name, 'action': item.action, - 'actionDescription': CALENDAR_ACTION_DICT[item.action]['description'], + 'actionDescription': CALENDAR_ACTION_DICT.get(item.action, {}).get('description', ''), 'atStart': item.at_start, 'eventsOffset': item.events_offset, 'params': json.loads(item.params), @@ -174,6 +174,8 @@ class ActionsCalendars(DetailHandler): calendar = Calendar.objects.get(uuid=processUuid(self._params['calendarId'])) action = self._params['action'].upper() + if action not in CALENDAR_ACTION_DICT: + self.invalidRequestException() eventsOffset = int(self._params['eventsOffset']) atStart = self._params['atStart'] not in ('false', False, '0', 0) params = json.dumps(self._params['params'])